Backelite / MaryPopin

Category to display modal-like view controllers with more options
http://backelite.github.io/MaryPopin/
MIT License
379 stars 46 forks source link

Selectable Custom TransitionStyle for in and out #29

Open mehmetcirak opened 10 years ago

mehmetcirak commented 10 years ago

Can i select my TransitionStyle for in and out animation. Or define in the BKTPopinTransitionStyleCustom block for example:

    [popin setPopinCustomInAnimation:^(UIViewController *popinController, CGRect initialFrame, CGRect finalFrame) {

        [popin setPopinTransitionStyle:BKTPopinTransitionStyleSnap];

    }];

    [popin setPopinCustomOutAnimation:^(UIViewController *popinController, CGRect initialFrame, CGRect finalFrame) {

        [popin setPopinTransitionStyle:BKTPopinTransitionStyleSlide];

    }];
sparga commented 10 years ago

Transitions style are symmetric. But if you really need a different style for out animation, you can change the popinTransitionStylein the completion block called after popin presentation. It would give something like that :

[self.navigationController presentPopinController:popin animated:YES completion:^{
        //Code to run on completion
        //Change transition style
        [popin setPopinTransitionStyle:BKTPopinTransitionStyleSlide];
}];
mehmetcirak commented 10 years ago

Thanks for help.But this not worked me when I'm clicked fastly.if i wait 2-3 second is working.Can i lock transition ,completion block is working.. My code is :

PopInViewController *popin = [[PopInViewController alloc]init];

BKTBlurParameters *blurParameters = [BKTBlurParameters new];
blurParameters.alpha = 1.0f;
blurParameters.radius = 8.0f;
blurParameters.saturationDeltaFactor = 1.8f;
blurParameters.tintColor = [UIColor colorWithRed:0.150 green:0.150 blue:0.035 alpha:0.2];
[popin setBlurParameters:blurParameters];
[popin setPopinOptions:[popin popinOptions]|BKTPopinBlurryDimmingView|BKTPopinDisableAutoDismiss];

[popin setPopinTransitionStyle:BKTPopinTransitionStyleSnap];
[popin setPopinTransitionDirection:BKTPopinTransitionDirectionTop];

[self presentPopinController:popin animated:YES completion:^{

    [popin setPopinOptions:BKTPopinDefault];
    [popin setPopinTransitionStyle:BKTPopinTransitionStyleSlide];
    [popin setPopinTransitionDirection:BKTPopinTransitionDirectionBottom];

}];

what is wrong.

sparga commented 10 years ago

Your code looks correct. But I think what you mean. When you click before the animation is over, the dismiss is not working as expected. And the snap transition is the longest, so it is really obvious with this one. One way to prevent that would be disabling user interaction on popin during transitions.