I am experiencing a weird visual glitch whereby reloading a section of my UITableView
is causing the semitransparent header view (alpha=0.25) to flash briefly darker, as if it were adding another copy of the header view on top of the old one and then removing the previous one.
My header view itself is a UIImageView
generated dynamically, however I've simplified it to just a UIView
with a backgroundColor
of [[UIColor blackColor] colorWithAlphaComponent:0.25]
and it still exhibits the problem:
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
UIView* view = [[UIView alloc] initWithFrame:CGRectMake(0,0,tableView.width, kModPopHeaderHeight)];
view.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.25];
view.opaque = NO;
return view;
}
As you can see I'm setting opaque
to NO
, but that doesn't have any effect. I've also tried keeping a dictionary of previously generated views indexed on the section and returning the existing view if it has already been created (to test my theory of it showing two views overlapping) but that also surprisingly had no effect. It flashes regardless.
Note that if I set the alpha of the header to 1.0
there is no visual glitch, so it clearly has something to do with the transparency. It also doesn't happen on every tap (reload), but most. I just can't figure out what I need to change in order to get it to draw properly. Any advice would be appreciated.