【发布时间】:2012-05-30 17:19:49
【问题描述】:
这是我在 ProfilTableViewController.m 的表视图委托中的 If 语句的摘录:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *currentCell =(UITableViewCell *)[tableView cellForRowAtIndexPath:indexPath];
// Navigation logic may go here. Create and push another view controller.
if (currentCell.textLabel.text==@"phrase") {
MainViewController *phraseViewController =[[MainViewController alloc] initWithNibName:@"mesPhrase" bundle:nil];
[self.navigationController pushViewController:phraseViewController animated:YES];
}
在故事板上,我创建了一个从 ProfilTVC 单元到 MainViewController 的推送,并将 TableViewController 更改为“MainViewController”
当我运行应用程序时,单击 ProfilViewController 中的单元格不会执行任何操作:/ 什么鬼?
干杯, 路易斯
【问题讨论】:
-
为什么不使用 prepareForSegue?
-
从我阅读(和理解)的内容来看,prepareforsegue 旨在将信息传递给新视图。但是,我使用从单元格到新的 tableviewcontroller 的 segue。我用故事板设置它。我做对了吗?
-
我实际上是从一个基于标签栏的项目开始的,它运行良好。最后一个没有什么真正有用的,我想我错过了一件大事。谢谢你的帮助!
标签: ios uitableview uinavigationcontroller pushviewcontroller