You’re on the right track! Here’s what you need to do:
-
Create a standard UIViewController subclass with its accompanying view xib.
-
Add a UITableView in the XIB.
-
Wire everything up. The view controller will be the delegate and the datasource for your table, so you must implement both protocols.
-
In your implementation file, add all of the necessary datasource and delegate methods needed for the tableview:
(UITableViewCell *)tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexPath *)indexPath
Your header file may look something like this:
MyViewController.h
@interface MyViewController : UIViewController <UITableViewDataSource, UITableViewDelegate>
{
IBOutlet UITableView *myTableView;
//This outlet is only necessary if you need to send messages to the table view (such as reloadData)
}
@end
That should do it!