我有一個UIViewController,這個控制器包含在一個navigationController中。 我在這個viewController中添加一個UITableViewController。當我按下tableView的單元格時,我想調用pushViewController方法。pushViewController with tableViewController in viewController
我嘗試這樣做:
的UITableViewController
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
FirstView *myViewController = [[FirstView alloc] init];
[f myViewController];
}
的UIViewController(的firstView)
-(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方法中,我可以看到它。所以我不明白爲什麼我不能推它。
任何想法?
反正什麼? – willcodejavaforfood 2010-02-10 09:33:55
Oups我將f更改爲myViewController var name以獲得更多理解,但我忘記在我的調用中更改它。所以:[myViewController pushIt] – Pierre 2010-02-10 11:55:30