Can you add a UITableViewController’s TableView to another View?

You’re on the right track! Here’s what you need to do:

  1. Create a standard UIViewController subclass with its accompanying view xib.

  2. Add a UITableView in the XIB.

  3. Wire everything up. The view controller will be the delegate and the datasource for your table, so you must implement both protocols.

  4. 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!

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)