2011-03-20 50 views
0

嗨,我開始使用分割視圖模板爲iPad編寫分割視圖應用程序。在根視圖控制器(在左邊的表視圖)我想集合中的小區像這樣的細節文本標籤:當我運行的應用程序只有主文本標籤(標籤上單元格細節文本視圖不顯示?

cell.detailTextLabel.text = [NSString stringWithFormat:@"%d", indexPath.row]; 

然而單元格的左側)。細節標籤中沒有任何內容。

我在做什麼錯?

回答

5

確保您的細胞作爲UITableViewCellStyleSubtitle

+3

其實它是UITableViewCellStyleValue1,但是謝謝... – cgossain 2011-03-20 22:48:51

3

創建在的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; 

選項:在設置應用程序

UITableViewCellStyleValue1,//等)

UITableViewCellStyleValue2,//聯繫方式

UITableViewCellStyleSubtitle // Detail的灰色格式。

+0

我使用的是Value1,它沒有顯示detailTextLabel文本。 – 2015-07-30 18:24:39

相關問題