Moved creation of _visualEffectView out of layoutSubviews
This commit is contained in:
parent
abf323b288
commit
9eba3f72ac
|
@ -4,7 +4,7 @@
|
|||
|
||||
@implementation BlurView {
|
||||
UIVisualEffectView *_visualEffectView;
|
||||
BlurView *blurEffect;
|
||||
UIBlurEffect * blurEffect;
|
||||
}
|
||||
|
||||
- (void)setBlurType:(NSString *)blurType
|
||||
|
@ -22,7 +22,13 @@
|
|||
} else {
|
||||
blurEffect = [BlurAmount effectWithStyle:UIBlurEffectStyleDark];
|
||||
}
|
||||
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
_visualEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
|
||||
_visualEffectView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
||||
_visualEffectView.frame = self.bounds;
|
||||
[self insertSubview:_visualEffectView atIndex:0];
|
||||
});
|
||||
}
|
||||
|
||||
- (void)setBlurAmount:(NSNumber *)blurAmount
|
||||
|
@ -30,13 +36,4 @@
|
|||
[BlurAmount updateBlurAmount:blurAmount];
|
||||
}
|
||||
|
||||
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
[super layoutSubviews];
|
||||
_visualEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
|
||||
_visualEffectView.frame = self.bounds;
|
||||
[self insertSubview:_visualEffectView atIndex:0];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in New Issue