Skip to content

UIVisualEffectView/UIBlurEffect for overlay #20

Open

Description

@romanr

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions