【发布时间】:2012-03-15 09:41:06
【问题描述】:
我有一个基于视图的应用程序。我在其中一个 UIViewControllers 上添加了一个 UITableView。它显示了数据,我实现了所有的委托方法等。我的问题是当我想显示 detailView 时它就不会发生。我的代码:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
DetailViewController *detailViewController =[[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:nil];
NSLog(@"DidSelectRowAtIndexPath");
// Pass the selected object to the new view controller.
[self.navigationController pushViewController:detailViewController animated:YES];
[detailViewController release];
}
我发现我需要一个 navigationController 但我没有,而且我尝试以编程方式添加一个但没有成功。我的 appDelegate 中也没有,所以我的问题是我需要添加一个来显示详细视图吗?如果是,请给我一个代码示例如何做到这一点。 如果没有,还有什么办法?
我是 iOS 新手,所以我有点迷路了。 请帮忙!
【问题讨论】:
标签: iphone ios xcode uitableview uinavigationcontroller