how to change background TableView without make background tableViewCell same like it?
ok, I have tableView that will show tableViewCell. But I want to make the two to have a different background because if I changed the tableview background the tableviewCell background just changed into the same as tableView. Is there anyway so I could make them into a different background color? thanks in advance.
It's as if t开发者_Python百科he tableViewCell's background doesn't matter as if it's always clear. The color of the tableViewCell always match the tableView.
You can check for indexPath.row in cellForRowAtIndexPath and change the backgroud color for only two rows -
if(indexPath.row < 2)
{
///change backgroud here...
}
the above will work if you are not using reusable cells.
[tableView setBackgroundColor:[UIColor colorWithRed:.85 green:.55 blue:.82 alpha:1]];
You can change the red , green,blue value and get awesome colors.
精彩评论