dismissModalViewController with transition: left to right

后端 未结 3 1239
夕颜
夕颜 2020-12-08 05:17

I was using a nice method to dismiss my modal view controller:

[self dismissModalViewControllerWithTransition:2];

which makes a slide trans

3条回答
  •  [愿得一人]
    2020-12-08 06:10

    Try this:

    I asume you are dismissing a view controller 2 from view controller 1. In view controller 2 you are using this

    [self  dismissModalViewControlleAnimated: NO]];
    

    Now In the first view controller, in viewWillAppear: method add the code

    CATransition *animation = [CATransition animation];
    
    [animation setDelegate:self];
    [animation setType:kCATransitionPush];
    [animation setSubtype:kCATransitionFromLeft];
    
    [animation setDuration:0.50];
    [animation setTimingFunction:
     [CAMediaTimingFunction functionWithName:
      kCAMediaTimingFunctionEaseInEaseOut]];
    
    
    [self.view.layer addAnimation:animation forKey:kCATransition];
    

提交回复
热议问题