Customise UINavigationController animation: CATransition

最后都变了- 提交于 2019-12-05 09:19:49

I think you should use [[self navigationController] pushViewController:vctwo animated:NO]; rather than animated:YES.

I suppose the only way to do this is to forget UINavigationController and come up with my own mechanism to handle everything:

This blog explains how...

So if you wanted to custom animations between VCs, do not use UINavigationController. Here is sample code to swap between two VCs as described above:

    -(void)slideDoorOpenTo:(UIViewController *)aController duration:(float)aDuration {

    [aController viewWillAppear:YES];
    [activeController viewWillDisappear:YES];

    //aController.view.alpha = 0.0f;
    [self.view insertSubview:aController.view belowSubview:activeController.view]; // so that it is below activeController

    [aController viewDidAppear:YES];

    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:aDuration];

    aController.view.transform = CGAffineTransformMakeTranslation(0,0);
    activeController.view.transform = CGAffineTransformMakeTranslation(-320,0);

    [UIView commitAnimations];

    [self performSelector:@selector(animationDone:) withObject:aController afterDelay:aDuration];


}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!