reloadData 图片会闪烁

当【collectionview reloadData】时,如果cell中包含Image,那么Image会闪烁一下,原因是UIView的隐式动画造成的,可以通过下面方法解决。

[UIView animateWithDuration:0 animations:^{
        [collectionView performBatchUpdates:^{
            [collectionView reloadData];
        } completion:nil];
    }];
[UIView setAnimationsEnabled:NO];
    [collectionView performBatchUpdates:^{
        [collectionView reloadData];
    } completion:^(BOOL finished) {
        [UIView setAnimationsEnabled:YES];
    }];

猜你喜欢

转载自blog.csdn.net/wjy0629/article/details/81094574