【发布时间】:2014-10-22 21:47:29
【问题描述】:
非常简单的表格视图:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 2;
}
- (float)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return 44;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SettingsCell"];
UILabel *label = (UILabel *)[cell viewWithTag:1];
switch (indexPath.row) {
case 0:
{
label.text = @"One";
break;
}
case 1:
{
label.text = @"Two";
break;
}
default:
break;
}
return cell;
}
当我点击一个单元格时不会调用didSelectRowAtIndexPath。
单元格也重叠:
这里会发生什么?我可以滚动表格,但无法选择单元格。在某一时刻,这是有效的,我不知道出了什么问题。
我正在使用原型单元格,并且在情节提要中将“选择”设置为“单选”。所有视图都有 userInteractionEnabled = YES。
【问题讨论】:
标签: ios xcode uitableview didselectrowatindexpath