I'm trying to create custom UIViewController with a UITableView, load the UIViewController using a xib file and add the view as a subview to another UIView.
The hierarchy is like this:
- UIViewController
- UIView << add custom UIViewController's view
- UIView
- UIView
Here's my xib view hierarchy and settings:
- UIView
- UITableView
Connection in IB:
- File's Owner:CustomTableViewController
- Outlets:
- view connected to UIView
- tableView connected to File's Owner
- delegate connected to File's Owner
- datasource connected to File's Owner
I have both UITableDataSource and UITableDelegate implemented. When i tried to add the view as a subview, it crashed ...
- (void)viewDidLoad
{
[super viewDidLoad];
CustomTableViewController* controller = [[CustomTableViewController alloc] initWithNibName:@"CustomTableView" bundle:[NSBundle mainBundle]];
[self.viewContainer addSubview:controller.view];
}
What am i missing?