UIViewControllerがあります。このコントローラーはnavigationControllerに含まれています。このviewControllerにUITableViewControllerを追加します。tableViewのセルを押すときに、pushViewControllerメソッドを呼び出したいと思います。
私はこれを試しました:
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メソッドに入れて、それを見ることができます。だから、なぜプッシュできないのかわかりません。
何か案が?