我有一个带有自定义单元格的tableView,当我选择一行时没有发生任何事情?
- (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];
}
答案 0 :(得分:0)
选择选项已被阻止。谢谢毒蛇王