Im using storyboard to create a collectionview which displays incoming Instagram Pics. Can someone take a look at my project to find out why it is not working?
*Edit The main issue lies in either the storyboard or the class called StreamViewController.m
The project was cut down for the most essential parts so dont worry about digging through a project.**
https://docs.google.com/file/d/0B9J0YAIS_BJPcFhvdzJ3LVV2Znc/edit?usp=sharing
I've looked through StreamViewController and you never set self as the delegate or datasource for "collectionView".
Related
Used CollectionView-Simple sample code from apple. when run their project it works. But when run my project which is exactly same as apple sample code it doesn't shows images with grid layout but shows only navigation bar. Any idea why it is so.
Thanks for suggestions.
Check your dataSource and delegate for the UICollectionView in IB and make sure they are set just like the sample. More than likely you forgot to assign the delegate and dataSource to the UICollectionView.
Data Source and Delegate
You need to make sure that the collection view's dataSource and delegate are set properly.
If you are using Interface Builder, then make sure that you right-click drag* from the collection view to the little orange blob at the bottom of the scene. Repeat twice, once for both the Data Source and the Delegate.
If you are creating the view in code, you just need to say
self.cview.delegate = self;
self.cview.dataSource = self;
* AKA control-click
I have made a pretty little UI on storyboard but I'm quite new to XCode and Objective C (coming over from Java) and I'm having some trouble adding functionality. I know that I should make a subclass of UITableViewController (storeTableViewController) and set the class of the storyboard controller to that. The problem is that when I do that all my hard work in the storyboard is erased, and I can see where the code is conflicting with the showing of my UI (for instance, the tableView:numberOfRowsInSection returns 0 always), and I think that with enough time and patience I could program the UI, but is there any way that I can use all this work that I've done on the storyboard and still be able to add functionality? I want to set a text box at the top to be the first responder as well as be able to change an image and labels on command programmatically.
You should probably use IBOutlets. Connect the StoryBoard UI Object to IBOutlets and you can modify the properties of the UI objects from the code
You can declare IBOutlet link this
IBOutlet type variableName
Check this tutorial video which will help you a lot.
Video Link
I use the storyboard as a canvas. I plug in the outlets that I want and all the little details and then I go around and built the classes. That being said, you need to declare a urtext field outlet (depending to what you want it to do) then add the delegates necessary and allow it to perform on selector. Then you can declare the function. Linking it in storyboard is easy by control and drag.as far the image you can use an uiimage and declare its function and how it changes depending to what the changes are the code varies. My suggestion is to take screen shot of your storyboard and post it with your question so I/ we can help you with the code. But as far as your question goes I hope this answer satisfies you. Happy coding.:)
So, I've laid out a UITableViewController with two prototype cells, and a view in the TableView's header area. In the header area, there are two views that each hold an icon and a label, Friends and Groups.
It looks all good in the Storyboard Editor, but when the screen actually loads, the images and labels in question are gone. I'm fairly new to iOS, so I haven't run into this before. Here are a couple screen shots to illustrate:
In the storyboard editor:
On the simulator:
Any thoughts? Thanks in advance for your help.
You've implemented the data source methods in your view controller, correct?
If not, UITableView will call a method that its data source implements: tableView:cellForRowAtIndexPath: from the UITableViewDataSource protocol, where you would return the cell to use, in this case the cell with the Identifier that you specified in your Storyboard.
We figured out that this was because the tableHeaderView of a UITableView is really weird about updating/redrawing. It's very difficult to get it to act in any sort of expected behavior.
Instead of using UIImageViews, we used UIButtons. The buttons seem to know how and when to updated and redraw themselves, so that worked.
I'm very new to iPhone programming, and I'm currently following tutos to understand the whole thing. I've been able to do what I needed (retrive data from a JSON http server, parse them with YAJL and plot the data in core plot). I have done this in a "simple" view where I have added a UILayerHostingView as requested by core-plot.
I am now trying to follow this tuto: http://blogs.remobjects.com/blogs/mh/2010/01/26/p973 but I am missing the first part regarding the views...
My understanding is that I need to create a view with a UITableView first. Then add a UITableCellView to make the first cell be able to contain the graph ? Is this right ? Where does the method "(id)initWithStyle:(UITableViewCellStyle)style" come from ?
For my needs, only the first cell needs to contain a graph, I will put some other info in the other cells.
As for now, I have created a new GraphListViewController, in the corresponding view I have added a listview but I do not see any auto generated methods regading cell customisation ? Do I need to implements DataSource in this controller and manually add some customisation methods ? Do I need to add a UITagbleViewCell to this UITableViewTable within IB ?
Hope I am not getting to confusing...
Thanks a lot for your help,
Best Regards,
Luc
To start with, create a new file ...
Cocoa Touch Class -> UIViewController subclass
and click the UITableViewController subclass checkbox. This will do all the tableview work for you. You can now open the xib file and change all the properties that you want for this.
Once this is done you need to populate the cells within the table. The first thing you need to do is to tell the controller how many cells to display. For this update the numberOfRowsInSection: method to return how many you want.
The next part is where you want to create the cell and is done mainly in the cellForRowAtIndexPath and for this I'm gonna redirect you to the following good tutorial on adding custom cells.
http://iphonedevelopment.blogspot.com/2009/09/table-view-cells-in-interface-builder.html
This explains a bit of the 'magic' that happens
Hope this helps
Liam
It seems that you must use the TTThumbsViewController to accomplish this. However, in the example code, TTThumbsViewController is only ever used to manage a scrollview of thumbs. How do you configure it to display cells instead?
_________Original Question_________
Has anyone used the Three20 source and made a tableview (not Fields)?
I am trying to figure out how to insert the TTThumbTableViewCell in a table and it none of the examples even address the tableviewcell classes (just the tablefields).
If you know how to setup a table to use these cell classes, can you post how you accomplished it?
Thanks
I haven't really used Three20 myself, but took a quick look on the source code.
It seems that Three20 have abstracted a creation of table view cells in generic TTTableViewDataSource. It queries class of a table view cell to be created via tableView:cellClassForObject:. TTThumbsDataSource in TTThumbsViewController.m then overrides that to return TTThumbTableViewCell class for TTPhoto objects.
So, if you are not using TTThumbsViewController, you should use TTThumbsDataSource as a dataSource for your table view or create your own similar class.
I was mistaken in how Three20 was setup.
A TTThumbsViewController is a Table view of TTThumbTableViewCells already. You just can't see the lines between the cells.
You can change the way the cells behave by subclassing TTThumbTableViewCells.