我试图将一些文本显示为 subtitle tableView .
subtitle
tableView
这是我的代码 :
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *SimpleTableIdentifier = @"SimpleTableIdentifier"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:SimpleTableIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:SimpleTableIdentifier] autorelease]; } //did the subtitle style NSUInteger row = [indexPath row]; cell.textLabel.text = [listData objectAtIndex:row]; return cell; cell.detailTextLabel.text = @"Hello there"; //This is not displaying... } }
我跑步时看不到字幕有什么原因吗?
return cell; cell.detailTextLabel.text = @"Hello there"; //This is not displaying...
你设置了 detailTextLabel 在你之后 return 返回
detailTextLabel
return
返回