【发布时间】:2011-06-25 07:07:36
【问题描述】:
我创建了 nib 文件,并且正确地完成了所有连接。当我运行应用程序并选择一个单元格时,新的笔尖根本没有打开。请帮忙!
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
//Get the selected country
NSString *selectedCountry = [[NSString alloc] initWithFormat:@"you pressed for this."];
//Initialize the detail view controller and display it.
DetailViewController *dvController = [[DetailViewController alloc]
initWithNibName:@"DetailView" bundle:[NSBundle mainBundle]];
dvController.selectedCountry = selectedCountry;
[self.navigationController pushViewController:dvController animated:YES];
[dvController release];
dvController = nil;
}
【问题讨论】:
-
释放
selectedCountry否则你会泄露。它在导航控制器上吗?在pushViewController:animated:方法之后立即尝试NSLog(@"%@ %@", self.navigationController, dvController);并告诉我们结果。 -
你犯了哪个错误?
dvController = nil;也不需要,因为你之前从内存中删除了 dvController。 -
@Deepak,我在 DetailViewController.m 中发布了 selectedCountry 并尝试了您告诉我的内容,但没有成功!
-
@Sherilyn,我实际上没有收到任何错误。它构建得非常好,但是当我单击单元格时,笔尖根本没有加载。我也尝试删除 dvController = nil 但它没有做任何事情。不过谢谢!
标签: iphone objective-c iphone-sdk-3.0