Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/100.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iOS-UICollectionView阴影在重新加载单元格时闪烁_Ios_Objective C_Iphone - Fatal编程技术网

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:^{}]动画块内运行性能更新调用来避免闪烁。但它会导致现有动画代码的中断

有什么方法可以避免这个闪烁的问题吗

多谢各位