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

Fade animation for 'Done' button... #3

Closed
teamtomsk opened this issue Oct 15, 2014 · 7 comments
Closed

Fade animation for 'Done' button... #3

teamtomsk opened this issue Oct 15, 2014 · 7 comments

Comments

@teamtomsk
Copy link

I can't seem to be able to apply the fade duration to the default 'Done, 'OK' default button. Whatever I do, I just get an immediate removal from the superview.

Any ideas?

@dogo
Copy link
Owner

dogo commented Oct 15, 2014

Hi @teamtomsk,
Currently the 'Done, OK' default behaviour is make it invisible and remove from super view.

// Close SCLAlertView
- (void)hideView
{
    [UIView animateWithDuration:0.2f animations:^{
        self.shadowView.alpha = 0;
        self.view.alpha = 0;
    } completion:^(BOOL completed) {
        [self.shadowView removeFromSuperview];
        [self.view removeFromSuperview];
        [self removeFromParentViewController];
    }];
}

What you can do ?
Not tested :

SCLAlertView *alert = [[SCLAlertView alloc] init];

[alert addButton:@"Done/OK" actionBlock:^(void) {
   //Do your custom fade animation
}];

[alert showSuccess:self title:@"Title" subTitle:@"Text." closeButtonTitle:nil duration:0.0f];

It's in my TODO list add custom animations, you can also fork and make a PR.

@mamaral
Copy link

mamaral commented Oct 18, 2014

I know what the issue is and will hopefully have a pull request with the fix in a bit. In a nutshell, hideView is being called twice when hitting the done button, but only called once when tapping outside, and calling it twice basically at the same time causes the UIView animation/completion blocks to be glitchy and the animation to fail.

@dogo
Copy link
Owner

dogo commented Oct 18, 2014

Yep, @mamaral you're right it's a error, I should fix this over the week. Thanks for pointing out this error

@mamaral
Copy link

mamaral commented Oct 18, 2014

Ahh yes it appears to be related to these chunks of code:

if(completeText != nil)
{
    [self addButton:completeText target:self selector:@selector(hideView)];
}

and in buttonTapped:

[self hideView];

@dogo
Copy link
Owner

dogo commented Oct 18, 2014

Yeah, I saw that! Should be fixed now

@mamaral
Copy link

mamaral commented Oct 18, 2014

Ahh, beat me to it.. I just put out #8 which I think more directly addresses the issue that there were two selectors being added to the done button, and that PR makes it so the default done button is created differently, so it doesn't have two selectors attached to it.

@dogo
Copy link
Owner

dogo commented Oct 18, 2014

This issue is fixed! Closing...

@dogo dogo closed this as completed Oct 18, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants