【发布时间】:2014-11-25 05:52:33
【问题描述】:
我有一个简单的故事板项目,带有一个 UITableViewController 和一个详细的 VC。表视图控制器有一个自定义类,它是表的委托和数据源。
我正在使用以下代码创建单元格:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellId = @"cellId";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle
reuseIdentifier:cellId];
}
// Configure the cell...
return cell;
}
storyboard中tableview的定义如下:
它显示正确,但是,当我单击一个单元格时,什么也没有发生,并且 prepareforSegue:sender: 永远不会被调用。
在storyboard中,tableview cell连接到detail VC:
我已经检查过类似的问题,但似乎没有任何问题适用于我的情况。设置了 tableview 的自定义类,所有委托和数据源接线似乎都可以。
我对故事板很陌生,所以我担心错误一定是在它的配置中。如果我实现 didSelectRow... 我可以让系统按预期工作,但我想用 segues 来做。
【问题讨论】:
-
告诉我你已经使用 push segue 将你的 UITableViewController 与详细视图连接起来。
-
那么 segue 应该在哪里调用?
performForSegue:在代码中?在 Storyboard 上,它在哪里连接? -
在您的故事板中单击单元格并创建您想要转入的任何
ViewController的转场。 -
我确实将 tableViewCell 链接到 Storyboard 中的 detailViewController。我刚刚用这些额外信息更新了我的问题。
标签: ios objective-c uitableview uistoryboard uistoryboardsegue