I am loading a cell from a xib directly using code below but the problem is background color of the cell is not showing even i had set in xib and i am also setting it through code. Can any guide me about the problem.
I want to know why it is not showing the background color set in xib
static NSString *cellIdentifier = @"GameCell123";
UITableViewCell *cell = [tableViewTemp dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil)
{
NSArray *array=[[NSBundle mainBundle] loadNibNamed:@"GameCell" owner:self options:nil];
if (array !=nil && [array count]>0)
{
cell=[array objectAtIndex:0];
}
[cell setAccessoryView:[cell viewWithTag:3]];
[(UIButton *)[cell viewWithTag:assessoryButtonCellSubviewTag] addTarget:self action:@selector(teamsAccessoryButtonTap:event:) forControlEvents:UIControlEventTouchUpInside];
cell.backgroundColor=[UIColor blueColor];
//cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellIdentifier] autorelease];
// seting teams button as accessory view;
}
As graver indicated, change the background color in the willDisplayCell delegate method: