0

I'm developing an Tab bar application in that i want to use navigation controller. In didSelectRowAtIndexPath i want to push the new view to the controller. I tried the following code but it did'nt help me.

DetailView *detailView = [[DetailView alloc] init];
[self.navigationController pushViewController:detailView animated:YES];

Can any one guide me where i'm doing wrong?

4

1 回答 1

0

如果没有父 UINavigationController 您可以创建一个并像这样调用它。

DetailView *detailView = [[DetailView alloc] init];
UINavigationController *navController = [[UINavigationController alloc]initWithRootViewController:myCont];
[self presentViewController:navController animated:YES completion:^{
    NSLog(@"Called on Completion");
}];

如果您已经有一个 UINavigationController 只需调用它

[self presentViewController:detailView animated:YES completion:^{
    NSLog(@"Called on Completion");
}];
于 2013-02-05T09:27:44.943 回答