我有一个 UIViewController,这个控制器包含在一个 navigationController 中。我在这个 viewController 中添加了一个 UITableViewController。当我按下 tableView 的单元格时,我想调用 pushViewController 方法。
我试过这个:
UITableViewController
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
FirstView *myViewController = [[FirstView alloc] init];
[f myViewController];
}
UIViewController(第一视图)
-(void)pushIt
{
SecondView *sCont = [[SecondView alloc] initWithNibName:@"SecondView" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:sCont animated:YES];
NSLog(@"didSelect"); // is printed
[sCont release];
sCont = nil;
}
但什么也没有发生。我把 NSLog() 放到我的 pushIt 方法中,我可以看到它。所以我不明白为什么我不能推动它。
任何的想法?