How to custom Modal View Controller presenting animation?

前端 未结 3 1829
借酒劲吻你
借酒劲吻你 2020-12-07 17:57

Instead of setting uiviewcontroller\'s modalTransitionStyle, I want to add an CAAnimation(or some other thing). This code can perform an custom animation in nav

3条回答
  •  鱼传尺愫
    2020-12-07 18:21

    You just need to add the transition to the window's layer, and present your controller rather than pushing it:

         CATransition* transition = [CATransition animation];
         transition.duration = 1;
         transition.type = kCATransitionFade;
         transition.subtype = kCATransitionFromBottom;
         [self.view.window.layer addAnimation:transition forKey:kCATransition];
         [self presentViewController:adjustViewController animated:NO completion:nil];
    

提交回复
热议问题