iOS-UICollectionView阴影在重新加载单元格时闪烁
在我的集合视图中,我在集合单元格中添加了一个带有阴影的自定义视图 我使用以下代码向视图添加了阴影iOS-UICollectionView阴影在重新加载单元格时闪烁,ios,objective-c,iphone,Ios,Objective C,Iphone,在我的集合视图中,我在集合单元格中添加了一个带有阴影的自定义视图 我使用以下代码向视图添加了阴影 cell.shadowView.backgroundColor = [UIColor greenColor]; cell.shadowView.layer.masksToBounds = NO; cell.shadowView.layer.shadowColor = [UIColor redColor].CGColor; cell.shadowView.layer.s
cell.shadowView.backgroundColor = [UIColor greenColor];
cell.shadowView.layer.masksToBounds = NO;
cell.shadowView.layer.shadowColor = [UIColor redColor].CGColor;
cell.shadowView.layer.shadowOffset = CGSizeMake(-2.0f, 2.0f);
cell.shadowView.layer.shadowOpacity = 1.0f;
cell.shadowView.layer.shadowRadius = 4.0f;
cell.shadowView.layer.shouldRasterize = YES;
cell.shadowView.layer.rasterizationScale = [UIScreen mainScreen].scale;
每当我重新加载单元格时,重新加载的单元格每次都会闪烁。
下面是我用来重新加载单元格的代码
[self.collectionView performBatchUpdates:^{
NSIndexPath* indexPath = [NSIndexPath indexPathForRow:1 inSection:0];
NSArray* indexPathArray = [NSArray arrayWithObjects:indexPath, nil];
[self.collectionView reloadItemsAtIndexPaths:indexPathArray];
} completion:nil];
我想避免在重新加载电池时出现这种闪烁
我可以通过在[UIView Perform Without animation:^{}]动画块内运行性能更新调用来避免闪烁。但它会导致现有动画代码的中断
有什么方法可以避免这个闪烁的问题吗
多谢各位