命令cell.textLabel.text和cell.detailTextLabel.text在控制台中提供输出,但在模拟器的表视图上没有给出任何值...
这是生成我所使用的单元格的代码。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"bookCell";
UITableViewCell *cell;
cell= [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
cell=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
// Book *bookDetail=[booksArrayDataSource objectAtIndex:indexPath.row];
cell.accessoryType=UITableViewCellAccessoryDetailDisclosureButton;
cell.textLabel.text= [self titleForRow:indexPath];
NSLog(@"title for row= %@", cell.textLabel.text);
cell.detailTextLabel.text= [self subtitleForRow:indexPath];
NSLog(@"subtitle for row= %@",cell.detailTextLabel.text);
return cell;
}发布于 2013-09-10 17:33:02
转到情节提要/xib并将单元格类型从dynamic更改为subtitle。
无论您在这里拥有什么,都不会被执行:
if (cell == nil)
{
...
}https://stackoverflow.com/questions/18711318
复制相似问题