LGPlusButtonsView icon indicating copy to clipboard operation
LGPlusButtonsView copied to clipboard

UIVisualEffectView/UIBlurEffect for overlay

Open romanr opened this issue 10 years ago • 0 comments

I was trying to implement blur effect for overlay, but it seems like it may require significant refactoring of initialization.

Header:

@property (assign, nonatomic) BOOL useCoverBlurEffect;
@property (assign, nonatomic) UIBlurEffectStyle coverBlurEffect;

init:

      - (instancetype)initWithNumberOfButtons:(NSUInteger)numberOfButtons
                firstButtonIsPlusButton:(BOOL)firstButtonIsPlusButton
                          showAfterInit:(BOOL)showAfterInit
                     useCoverBlurEffect:(BOOL)useCoverBlurEffect
{
    self = [super init];
    if (self)
    {

.....

_coverView = [UIView new];
        if (useCoverBlurEffect) {
            self.useCoverBlurEffect=useCoverBlurEffect;
            UIBlurEffect * effect = [UIBlurEffect effectWithStyle:_coverBlurEffect];
            _coverView = [[UIVisualEffectView alloc] initWithEffect:effect];
        }
        _coverView.backgroundColor = [UIColor clearColor];
        _coverView.userInteractionEnabled = YES;
        [self addSubview:_coverView];

this works if we pass yet another parameter to init and its gets really messy. maybe we can move inititlization of drawing to another method and call it after event moveToSuperView or something like that?

romanr avatar Jan 01 '16 13:01 romanr