【发布时间】:2015-03-08 15:04:29
【问题描述】:
环境:Xcode 6.1.1;故事板 问题: 我正在创建一些列表,其中 UITableView 嵌入在 UIViewContrller instoryboard 中,并且所有单元格都无法通过单击选择,但可以通过长按意外选择。 我不知道为什么,我无法弄清楚。 我希望有人帮助我。 思考。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
HBillCell *cell = [tableView dequeueReusableCellWithIdentifier:@"billCell"];
[cell loadInfo:self.dataSource[indexPath.row]];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[self performSegueWithIdentifier:@"bill2detail" sender:nil];
}
【问题讨论】:
-
您是否使用委托方法:didSelectRowAtIndexPath ?
-
只要你不显示一点代码,没有人会帮助你......
-
@sasquatch 是的,我已经链接了dataSource委托和tableview委托,所有数据都可以正确显示,只有长按才能触发didSelecteRowAtIndexPath被调用。
-
@grzegorz-krukowski 代码很简单。只是:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { HBillCell *cell = [tableView dequeueReusableCellWithIdentifier:@"billCell"]; [单元加载信息:self.dataSource[indexPath.row]];返回单元格; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [self performSegueWithIdentifier:@"bill2detail" sender:nil]; } -
不要将代码放在 cmets 中,它很难阅读。编辑您的问题以包含格式正确的代码。
标签: ios objective-c uitableview storyboard