开发者

UITableViewController detailView never pushed

I have a UITableViewController as one of 开发者_开发问答the view controllers on the second tab of my tab bar controller.

In didSelectRowAtIndexPath i create a detail view controller, but it never gets pushed onto the navigation stack... and the app doesnt crash either, as i can NSLog after the call to pushViewController.

This is the method:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    KeyboardViewController *v = [[KeyboardViewController alloc] initWithNibName:@"KeyboardView" bundle:nil];
    [self.navigationController pushViewController:v animated:YES];
    NSLog(@"gets here OK"); 
}

What would cause this? Surely if navigationController didn't exist then it would crash? Since this is a UITableViewController, it should be created automatically should it not?

Thanks


Surely if navigationController didn't exist then it would crash?

No, [nil method] does not crash.

Since this is a UITableViewController, it should be created automatically should it not?

A UITableViewController does not have a UINavigationController by default. You have to put the UITableViewController inside a UINavigationController.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜