Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UIButton not clickable #17

Open
lsantaniello opened this issue Mar 2, 2016 · 1 comment
Open

UIButton not clickable #17

lsantaniello opened this issue Mar 2, 2016 · 1 comment

Comments

@lsantaniello
Copy link

Hi,
I need to add a new button on scratchView when the progres is +0.9. When I add the button, it is not clickable. How can I solve the problem?

Thanks

@ghost
Copy link

ghost commented Mar 11, 2016

I updated 'MDScratchSampleViewController.h' for testing your problem...

#pragma mark - MDScratchImageViewDelegate

- (void)mdScratchImageView:(MDScratchImageView *)scratchImageView didChangeMaskingProgress:(CGFloat)maskingProgress {
    NSLog(@"%s %p progress == %.2f", __PRETTY_FUNCTION__, scratchImageView, maskingProgress);

    //Button test
    static  BOOL isPresented = NO;
    if(maskingProgress > 0.5 && isPresented == NO){
        isPresented = YES;
        UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
        [btn setImage:[UIImage imageNamed:@"paint01-02blur"] forState:UIControlStateNormal];
        btn.frame = CGRectMake(50, 50, 100, 100);
        [btn addTarget:self action:@selector(btnAction) forControlEvents:UIControlEventTouchUpInside];
        [scratchImageView addSubview:btn];
    }
}

-(void)btnAction{
    NSLog(@"%s", __PRETTY_FUNCTION__);
}

This is works fine. Please, check your button and button superviews user interaction. Check your button target action.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant