【发布时间】:2012-05-05 03:04:51
【问题描述】:
试图将新控制器推入导航控制器,不知道为什么它不工作。 1)我检查了 secondViewController 的实例也不起作用。 2)。尝试后缀“.xib”,也不起作用。 3) 试过 bundle:nil 也不行。
我正在使用 ARC。有人能指出这里有什么问题吗?
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@" YOU SELECTED ROW ..");
secondViewController *secController = [[secondViewController alloc] initWithNibName:@"secondViewController.xib" bundle:[NSBundle mainBundle]];
NSLog (@"View Controller %@ ", secController);
[self.navigationController pushViewController:secController animated:YES];
}
【问题讨论】:
-
您为什么使用 ARC 而不是 Storyboard?这可能会解决你的问题。我们还可以获得更多代码,例如您的 UINavigationController 实例化以及您的意思是它不起作用吗?是不是崩溃了,一片空白,什么都不做? secController 的 NSLog 显示了什么?
-
您是否在 MainWindow.xib 文件中实现了 UINavigationController?
标签: iphone objective-c ios5