iOS Dismiss and Present view controller custom animation

后端 未结 1 1787
情深已故
情深已故 2021-02-11 02:21

I have a view controller that I am presenting with the following objective c code:

CATransition *animation=[CATransition animation];
animation.delegate=self;
ani         


        
1条回答
  •  北荒
    北荒 (楼主)
    2021-02-11 03:11

    Presenting a view controller using a custom animation:

    CATransition* transition = [CATransition animation];
    transition.duration = 0.3;
    transition.type = kCATransitionMoveIn;
    transition.subtype = kCATransitionFromRight;
    [self.navigationController.view.layer addAnimation:transition forKey:kCATransition];
    [self.navigationController pushViewController:reader animated:NO];
    

    Dismissing a view controller using a custom animation:

    CATransition* transition = [CATransition animation];
    transition.duration = 0.3;
    transition.type = kCATransitionReveal;
    transition.subtype = kCATransitionFromLeft;
    [self.navigationController.view.layer addAnimation:transition forKey:kCATransition];    
    [self.navigationController popViewControllerAnimated:NO];
    

    0 讨论(0)
提交回复
热议问题