Marcelo
Marcelo

Reputation: 1196

Dismissing a ViewControll Upwards instead of downwards

I am presenting a simple modal ViewController calling

[self performSegueWithIdentifier:@"SegueLogOut" sender:nil];

However when i dismiss it I want it to move upwards instead of downwards, it it possible?

[self dismissViewControllerAnimated:YES completion:nil];

EDIT:

I tried to make a custom animation, It didn't work really well. The background stays black until the modal is dismissed...

    [UIView animateWithDuration:1 animations:^{
        self.view.frame = CGRectMake(0, -self.view.frame.size.height, self.view.frame.size.width, self.view.frame.size.height);
    } completion:^(BOOL finished) {
        [self dismissViewControllerAnimated:NO completion:nil];
    } ];

Upvotes: 3

Views: 104

Answers (1)

staticVoidMan
staticVoidMan

Reputation: 20234

Generally, to change the presentViewController animation style, you set a modalTransitionStyle property on the viewController.

ref: https://developer.apple.com/LIBRARY/IOS/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle

However, to answer your question, none of the (few) modalTransitionStyles have a predefined style to animate upwards.

You need to do the animation yourself.

Upvotes: 1

Related Questions