UITableView cell 半透明效果,改变cell高度时背景不闪的解决方法

时间:2023-03-09 20:18:26
UITableView cell 半透明效果,改变cell高度时背景不闪的解决方法

如果直接指定cell.backgroundColor = = [UIColor colorWithRed:255.0/255.0 green:255.0/255.0 blue:255.0/255.0 alpha:0.8];在ios7下改变cell高度时cell背景会闪

通过以下方法可避免此问题,将cell对背景色clear,cell的contentView的背景色置为半透明

cell.backgroundColor = [UIColor clearColor];

cell.contentView.backgroundColor = [UIColor colorWithRed:255.0/255.0 green:255.0/255.0 blue:255.0/255.0 alpha:0.8];