我制作了关于运行 iPhone 5S、Xcode 6 和 iOS 8 的教程。我想在单元格表中显示 textDetailLabel。你能帮我看看这里有什么问题吗?我已经检查了语法,但它不起作用
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
Checklist *checklist = [self.dataModel.lists objectAtIndex:indexPath.row];
cell.textLabel.text = checklist.name;
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
int count = [checklist countUncheckedItems];
if ([checklist.items count] == 0) {
cell.detailTextLabel.text = @"(No Items)";
} else if (count == 0) {
cell.detailTextLabel.text = @"All Done!";
} else {
cell.detailTextLabel.text = [NSString stringWithFormat:@"%d Remaining", count];
}
return cell;
}