I am using a tableView in my ViewController as IBOutlet. I have implemented all the delegates methods and data source methods. But the data is not showing there...what i did wrong there...
Please help...
Did you set the delegates and Data Source from IB to Files Owner. please check that
Hey you can use refer Link as UITableView Example and correct ur mistake. If u unable to this then show us code.
So we can help you.
Related
I am trying to follow a tutorial about xml parsing http://www.edumobile.org/iphone/iphone-programming-tutorials/parsing-an-xml-file/ . The tutorial does not explain how to link and that is the part that i am stuck on. Looking at the source code provided i can see that "view" is linked with "file owner". In MY file, when i do this, i cannot link them. It does not highlight. Does anyone know why? what are the usual causes for this? (new to iphone). Thanks for any help!
You will find this helpful http://mobiforge.com/developing/story/iphone-programming-fundamentals-outlets-and-actions
This one is specific to XCode4 but is also helpful to understand the Interface Builder basics
http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iPhone101/Articles/04_InspectingNib.html
If you add a new file (a subclass of view controller) you will get three files .h,.m and .xib. The File owner is always connected to the correct View Controller which happens to the owner of this nib(.xib) file. you can verify the same as shown in image below.
If this is the case then I am sure you can always link up your new elements (labels,buttons) to the correct Outlet. Just a reminder here that the declaration should start with the keyword IBOutlet so that It shows up in the interface builder.
eq IBOutlet UILabel *lblTitle;
Very new to programming for iOS and Cocoa so please take it easy on me as I try to wrap my brain around the following. I'm trying to display a tableview populated from an XML feed as the opening screen of my app. I've tried to consume the XML from inside my AppDelegate using the ApplicationDidFinishLaunching method (and then making my AppDelegate a delegate for the XML parser which I access using a NSUrlConnection and its delegate methods) but I can't figure out how to take the parsed XML file and pass it to a tableviewcontroller which can then use it as the datasource for a tableview. When I do try, I always get a blank tableview.
I've written the code a few times and nothing seems to work.. I'll post what I have here to show what I've got so far but I'm afraid its mostly vanilla AppDelegate with a few parser methods thrown in.. any pointers in the right direction would be super appreciated.
Thank you in advance!
Hmm, probably a bad idea to do the network call in the AppDelegate. Try to put all that code at the view controller level. Here's a brief structure of what I do (Since it's very similar)
View Controller listens to button events
Use ASIHTTPRequest to talk to your web service. Handles network really well, you can skip the NSURLConnection stuff.
Try to load your data source (an array?) with static values and see if they come up on the table view.
Parse the response from ASIHTTPRequest using NSXMLParser, and load the data you want into the static array you were using. More here.
Call [tableView reloadData] once you're done and the changes will reflect.
Did you specify a UITableViewDataSource for your table view and implement the two required methods?
tableView:cellForRowAtIndexPath:
and
tableView:numberOfRowsInSection:
http://developer.apple.com/library/ios/#documentation/uikit/reference/UITableViewDataSource_Protocol/Reference/Reference.html
When I get blank tables, this is what it is; I've forgotten to specify the data source
I have a tableview in my viewcontroller. But i have an error which say that [tableview:numberofrowinsection:]:unrecongized selector sent to instance. Can someone please tell me how cna i solve this.
You need to set the UIViewController as the delegate, and also datasource
also you need to implement the necessary methods.
if you look in the apple docs they are described there
but i think the main ones are:
numberOfSectionsInTableView:
tableView:numberOfRows:inSection:
and tableView:cellForRowAtIndexPath:
in the first one you return the number of sections, usually 1, in the second you return the number of rows for the section( usually the count of the array)
and in the final you return the UITableViewCell object with the necessary data put in position.
read the apple docs, and if necessary copy the method names from one of the UITableViewController templates.
hope this helps
Create a new file using the UITableViewController template - it has skeleton code that should help (even if you don't use it to build on, you can use it as an example of implementing the delegate methods and reusing cells).
How to access a table view cell in some other user defined methods other than those predefined methods for tableview???
Plz help...
Thanx in advance...
for that you have to take the cell as global variable and acess it anywhere.
But remember untill you call the tableview reload method no change is gonna reflect.
So I suggest better use the cell in predefined delegate methods rather than trying to experiment (which can cause problem in consistency).
Happy Coding...
I'm new with the iphone programming and I'm trying to know how to create all of these (UI's) without using the IB, so I'm only asking for the code lines that will create each one of these.
The best way to figure this out is to read through the documentation for each of these classes. Some which are subclasses of UIView can be instantiated with -initWithFrame:, for example.
i am new to iphone/ipad programming , i fallowed below links to create views programmatically... i think these are helpful to u also >>
To create UIButton,UILabel,UIImage,UITextField programmatically
http://www.edumobile.org/iphone/iphone-programming-tutorials/implement-uibutton-uitextfield-and-uilabel-programmatically-in-iphone/
To create UITableView Programatically
http://thesdkblog.com/2011/05/how-to-setup-a-uitableview-programmatically/
To create UINavigationController and UITabbarController Programmatically
http://codenugget.org/how-to-embed-a-navigation-controller-inside-a
http://www.xdracco.net/howto-implement-uinavigationcontroller-uitabbarcontroller-programmatically/
Thanks u..
I've Noticed that a lot of people viewed this question, so I was doing a search on this subject and I came through a great sample code, which can explain how to do a lot of things and here is the link to that sample code:
http://developer.apple.com/iphone/library/samplecode/uicatalog/Introduction/Intro.html
I hope that this will help.