您好我开始使用拆分视图模板为iPad编写拆分视图应用程序.在根视图控制器(左侧的表视图)中,我试图设置单元格的详细文本标签,如下所示:
cell.detailTextLabel.text = [NSString stringWithFormat:@"%d", indexPath.row];
Run Code Online (Sandbox Code Playgroud)
但是当我运行应用程序时只有主文本标签(单元格左侧的标签).细节标签中没有任何内容.
我究竟做错了什么?
在 cellForRowAtIndexPath 方法中
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
}
cell.textLabel.text = @"Heading";
cell.detailTextLabel.text = @"DetailValue";
return cell;
Run Code Online (Sandbox Code Playgroud)
选项 :
UITableViewCellStyleValue1, // 就像在“设置应用程序”中一样)
UITableViewCellStyleValue2, // 联系人样式
UITableViewCellStyleSubtitle // 灰色的详细信息文本。
归档时间: |
|
查看次数: |
3609 次 |
最近记录: |