我在商店有一个应用程序,它使用一个链接到UIViewController(DetailController)的RootViewController,我正在开发一个新的应用程序,基本上需要这个相同的功能。但相反,我的新应用程序在链接到UIViewController的UIViewController中有一个UITableView。所以我想,我将我的RootViewController代码复制并粘贴到这个新的UIViewController中。所以我已经连接了TableView,将委托和数据源设置为self,而TableView显示了项目的标题(Hurray),但是当触摸时,不会转到DetailController?我已经使用NSLog来确定哪个部分不起作用,当然还有didSelectRowAtIndexPath方法...这里是我的代码
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSDictionary *theItem = [items objectAtIndex:indexPath.row];
DetailController *nextController = [[DetailController alloc] initWithItem:theItem];
[self.navigationController pushViewController:nextController animated:YES];
[nextController release];
}
TableViewCell只突出显示蓝色,不链接到DetailController。
提前致谢!
答案 0 :(得分:0)
通过“不工作”意味着它没有被调用,或者它没有推动视图控制器?如果是第一个,那么请确保正确设置了表视图委托。如果是第二个,请确保nextController和self.navigationController都不是nil。