【发布时间】:2011-11-07 02:39:11
【问题描述】:
我有一个带有导航表视图的标签栏。当我在表格视图中选择一个单元格时,我的应用程序崩溃了。我希望在选择单元格时打开一个新的视图控制器。我的猜测是当 didselectrowatindexpath 被调用时我没有正确推动它。该应用会挂起几秒钟,然后关闭。
这段代码有什么吸引你的地方吗?或者你有任何示例代码吗?我正在使用 Xcode 3 和模拟器 4.3。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSInteger row = [indexPath row];
if (self.vailViewController == nil) {
VailViewController *vailView = [[VailViewController alloc] initWithNibName:@"View" bundle:nil];
self.vailViewController = vailView;
[vailView release];
}
vailViewController.title = [NSString stringWithFormat:@"%@", [resortsArray objectAtIndex:row]];
Ski_AdvisorAppDelegate *delegate = (Ski_AdvisorAppDelegate *)[[UIApplication sharedApplication] delegate];
[delegate.resortsNavController pushViewController:vailViewController animated:YES];
[self.navigationController pushViewController:vailViewController animated:YES];
}
非常感谢!
【问题讨论】:
-
我假设 vailViewController 是一个@property(保留)?
-
另外,什么是BookDetail?那应该是 vailView 吗?
-
会出现任何错误吗?
-
据我所知,您的代码很好。我们需要看看 self.vailViewController 属性是如何定义的。此外,如果您还可以提供应用程序崩溃时出现的特定错误消息/堆栈跟踪,那将非常有帮助。
-
调试器在崩溃时告诉我这一点。抛出“NSException”实例后调用终止程序收到信号:“SIGABRT”。
标签: iphone objective-c xcode3.2 didselectrowatindexpath