2011-03-04 13 views
6

मैं एक अनुकूलित सेल का पृष्ठभूमि रंग सेट करने की कोशिश कर रहा था लेकिन पृष्ठभूमि रंग प्रदर्शित नहीं होता है।आईपैड: विभाजित दृश्य में कस्टम सेल के पृष्ठभूमि रंग को सेट करने में असमर्थ

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]]; 
} 

क्या यह विभाजन के कारण है।

+0

क्या आप UITableViewCell क्लास को ठीक से उपclassing कर रहे हैं? वैकल्पिक रूप से, आप अपने सादे वेनिला UITableViewCell में उपविंग जोड़ने का प्रयास क्यों नहीं करते? अच्छा काम करता है। – Bourne

उत्तर

13

इसके बजाय cell.contentView.backgroundColor या cell.backgroundView.backgroundColor का उपयोग करने का प्रयास करें।

+2

cell.contentView.background रंग काम करता है –

संबंधित मुद्दे