UIViewController does not get displayed from UITableViewController
I've got UITableViewController and the body of the tableView:didSelectRowAtIndexPath: method is following:
if (indexPath.row == 0) {
MyViewController *myViewController = [[MyViewController alloc] initWithNibName:@"MyViewController" bundle:nil];
[self.navigationController pushViewController:myViewController animated:NO];
[myViewController release];
}
[tableView deselectRowAtIndexPath:indexPath anim开发者_Go百科ated:YES];
Unfortunately when I select the first row in the table view then my view in not displayed. When I debug I can see that it goes into the if statement, view controller is initialized and pushed onto the stack, but the view does not appear.
Any ideas? Thanks!
Sounds like the MyViewController.xib is not wired up correctly. Make sure that "File Owner" is set to the correct class and that it's view property connects to the view.
-pushViewController:animated:
loads the view of the viewController provided to it but if there is no view it doesn't complain.
精彩评论