Sur*_*ran 6 iphone objective-c ios
在我的集合视图中,我在集合单元格中添加了带阴影的自定义视图.
我使用以下代码将阴影添加到视图中.
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;
Run Code Online (Sandbox Code Playgroud)
每当我重新加载单元格时,重新加载的单元格每次都会闪烁.以下代码用于重新加载单元格.
[self.collectionView performBatchUpdates:^{
NSIndexPath* indexPath = [NSIndexPath indexPathForRow:1 inSection:0];
NSArray* indexPathArray = [NSArray arrayWithObjects:indexPath, nil];
[self.collectionView reloadItemsAtIndexPaths:indexPathArray];
} completion:nil];
Run Code Online (Sandbox Code Playgroud)
我想在重新加载单元格时避免这种闪烁.
我可以通过在[UIView performWithoutAnimation:^ {}]动画块中运行performBatchUpdates来避免闪烁.但它会导致现有动画代码破损.
有没有办法避免这个闪烁的问题?
谢谢.
| 归档时间: |
|
| 查看次数: |
503 次 |
| 最近记录: |