Objective c didSelectRowAtIndexPath未使用自定义单元格表视图执行
我有一个带有自定义单元格的tableView,当我选择一行时,什么都没有发生Objective c didSelectRowAtIndexPath未使用自定义单元格表视图执行,objective-c,uitableview,Objective C,Uitableview,我有一个带有自定义单元格的tableView,当我选择一行时,什么都没有发生 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [arrayOfExpectations count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [arrayOfExpectations count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
CustomTableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"CustomCell"];
Expectations *expectation = [arrayOfExpectations objectAtIndex:indexPath.row];
cell.quoteLabel.text = expectation.expText;
return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
// Calculate a height based on a cell
if(!self.customCell) {
self.customCell = [self.tableView dequeueReusableCellWithIdentifier:@"CustomCell"];
}
Expectations *expectation = [arrayOfExpectations objectAtIndex:indexPath.row];
self.customCell.quoteLabel.text = expectation.expText;
[self.customCell layoutIfNeeded];
// Get the height for the cell
CGFloat height = [self.customCell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height;
// Padding of 1 point (cell separator)
CGFloat separatorHeight = 1;
return height + separatorHeight;
}
- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 100;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
Expectations *expectation = [arrayOfExpectations objectAtIndex:indexPath.row];
expParentID = expectation.expID;
NSLog(@"PrevID = %@", prevexpParentID);
NSLog(@"NewID = %@", expParentID);
[self loadData];
}
选择选项被阻止。谢谢viper king您确定没有阻止单元格上的选择选项吗?您是否在情节提要中的原型单元格中设置了自定义单元格的类?如何在情节提要中的原型单元格中设置自定义单元格的类?类设置为CustomTableViewCell在哪里检查阻止的选择选项是否在单元格上?