I'm using a UIVisualEffect that applies a blur effect to a UIImageView inside a custom cell for a UICollectionView. This is used as the background of the cell which takes up the whole screen.
UIVisualEffect *blurEffect;
blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
self.blurEffect = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
self.blurEffect.frame = self.blurBackground.bounds;
[self.blurBackground addSubview:self.blurEffect];
When I scroll, the frame rate drops a bit until the cell movement stops.
I tried:
cell.layer.shouldRasterize = YES;
cell.layer.rasterizationScale = [UIScreen mainScreen].scale;
but this just makes things worse (I understood why on this thread).
I am using dequeueReusableCellWithReuseIdentifier.
From what I understand, the blur effect is getting re-calculated all the time, so perhaps I can save the blurred image instead of re-rendering it on every frame? Any idea how to do this?
Or any other ideas on how to improve performance?