like my question, I just want to ask someone who made an application using the background for his / her tableview and tableviewcell. Because I have a problem with this background. Here is my pic application with problem

I use graycolor for the background in tableview and whitecolor for the background in tableviewcell, I want the whole cell containing the text to have a whitecolor background, but I cannot do this. here is my code
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
UIView* backgroundView = [ [ [ UIView alloc ] initWithFrame:CGRectZero ] autorelease ];
backgroundView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"celltable_root.png"]];
cell.backgroundView = backgroundView;
for ( UIView* view in cell.contentView.subviews )
{
if(_segmentedControl.selectedSegmentIndex == 0){
FileModel *filemodels = [_filemodels objectAtIndex:indexPath.row];
if([filemodels.fileExpanse compare:@"display"]==0){
backgroundView.backgroundColor = [UIColor whiteColor];
}else{
backgroundView.backgroundColor = [UIColor whiteColor];
}
}
view.backgroundColor = [ UIColor clearColor];
}
[[self tableView] setBackgroundColor:[UIColor grayColor]];
}
Is there something wrong in my code?
source
share