簡體   English   中英

iPad:無法在拆分視圖中設置自定義單元格的背景顏色

[英]iPad: unable to set background color of custom cell in split view

我試圖設置自定義單元格的背景顏色,但不顯示背景顏色。

 ProjectListCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    cell = [[[ProjectListCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}

// Configure the cell...

if((indexPath.row%2)!=0)
{

    [cell setBackgroundColor:[UIColor redColor]];
}
else 
{

    [cell setBackgroundColor:[UIColor greenColor]];
}

這是因為splitview。

嘗試使用cell.contentView.backgroundColorcell.backgroundView.backgroundColor

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM