开发者

UIViewController does not get displayed from UITableViewController

开发者 https://www.devze.com 2022-12-16 23:43 出处:网络
I\'ve got UITableViewController and the body of the tableView:didSelectRowAtIndexPath: method is following:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号