简体   繁体   中英

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];
    } ];

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 ) modalTransitionStyle s have a predefined style to animate upwards.

You need to do the animation yourself.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM