views:

108

answers:

2

Hi all, I have a View with lots of things inside it including buttons, a scroll view and a tableView (ipad app). I am controller this view with a viewController subclass but I don't know how to manage my tableView. I don't know where put the methods : - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

should i add them to my ViewController or should i create a new subclass of UITableViewController (and get them "for free") and set the dataSource and delegate of my tableView to that class when I create it programmatically?

I am storing the data I want to show in my appDelegate following the tutorial : http://www.iphonesdkarticles.com/2008/10/sqlite-tutorial-selecting-data.html

I am new at developing and I fear I am spagetti coding.

Thanks a lot

+1  A: 

You just have to set the UIViewController as the delegate and dataSource of your UITableView. That's it. You don't need to create a own subclass of UITableViewController for managing that tableView. So you can put all the subviews in the viewController's view.

burki
A: 

Hi, Thank you so much, I got it. I was trying to create a tableView and then set it's datasource. In fact the easier way is to create a tableViewController and use it's .view property that is already linked to it and use the addSubview method to put it in the main viewController's view.

Cheers

dirrigc