I have a grouped tableview which I set its background like this in viewDidload;
self.tableView.backgroundView = nil;
self.tableView.backgroundColor = [UIColor clearColor];
self.tableView.separatorColor= [UIColor APP_SEPERATOR_COLOR];
and this is method I set:
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
cell.backgroundColor=[UIColor clearColor];
cell.backgroundView.alpha=0;
cell.textLabel.text=cellValue;
return cell;
This works ok but when there are 30-40 cells then the separation line and borders of table starts to get lost when I scroll down, and never comeback again..when I scroll up.
Any Ideas?
What happens is that the cells get reused when they scroll on and off the screen. In this case the customization in
tableView:cellForRowAtIndexPath:is called. This will override what is already drawn, including the border.Simply move your code styling the cell into the cell definition part: