我有两个
UITableView
嵌入在一个UINavigationController
中。在第一个表视图控制器中选择单元格应该会触发推送转换到第二个表视图控制器,但是这种转换没有被执行。
FirstTableVC
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// getting called as planned
if (indexPath.row == 0 && reload == YES) {
// working
[self pushedRefresh:self];
reload = NO;
return;
}
NSLog(@"past return"); // logged as planned
// NOT performing!
[self performSegueWithIdentifier:@"more" sender:[self.tableView cellForRowAtIndexPath:indexPath]];
}
我所做的/注意到的事情
SecondTblVC
的viewDidLoad:
方法没有被调用。但是,如果我使用非推送segue,视图控制器会正确地呈现。- 我尝试在
performSegueWithIdentifier:
方法的sender参数中使用nil
和self
,但结果相同。 - 我将第二个视图控制器转换为普通的
UIViewController
,结果相同。 - "更多"segue标签正确连接并标记为
push
- 没有崩溃,只是缺少segue。
- 我删除了故事板中的整个
UINavigationController
设置,并以相同的结果替换它。 - 我没有为
UINavigationController
创建单独的.h/.m文件 - 表格视图
delegates/data source
链接按计划工作。 - 在
performSegue
方法中记录学习到了destinationViewController
。
如果需要更多的代码和截图,请告诉我。
谢谢。
编辑 这是我的cellForRowAtIndexPath
实现:- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier = @"ReuseCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
cell.textLabel.text = [clubNames objectAtIndex:indexPath.row];
cell.detailTextLabel.text = [times objectAtIndex:indexPath.row];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:simpleTableIdentifier];
}
[cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
return cell;
}
cellForRowAtIndexPath
中创建的单元格是否具有在故事板中指定的原型单元格相同的标识符? - Mike S