Merge pull request #113 from StevenLambion/master

Moved creation of _visualEffectView out of layoutSubviews
This commit is contained in:
Alexey 2016-11-11 12:18:03 +01:00 committed by GitHub
commit 9afe2cb1c6
1 changed files with 8 additions and 11 deletions

View File

@ -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