简体   繁体   English

没有情节提要segue迅速的过渡动画

[英]Transition Animation without storyboard segue swift

I want to change animation when ViewController navigate to another ViewController. 我想在ViewController导航到另一个ViewController时更改动画。 I am using storyboard but I am not creating Segue. 我正在使用情节提要,但未创建Segue。 Navigation done with storyboardID my code for navigation is: 使用storyboardID进行导航,我的导航代码是:

let SB = UIStoryboard(name: "Main", bundle: nil)
let vc = SB.instantiateViewControllerWithIdentifier("StartRecordingView")
self.navigationController?.pushViewController(vc, animated: true)

Now I want to change transition animation during naivation. 现在,我想在导航期间更改过渡动画。 I searched lot but all solutions is for segue. 我搜索了很多,但所有解决方案都是针对segue的。 Can anyone here help how to change animation. 有人可以帮忙更改动画吗?

You can do it by navigation controller delegate to modify behavior when a view controller is pushed or popped from the navigation stack of a UINavigationController object. 您可以通过导航控制器委托来执行此操作,以在从UINavigationController对象的导航堆栈中推入或弹出视图控制器时修改行为。

-navigationController:animationControllerForOperation:fromViewController:toViewController:

Declaration: 宣言:

 - (id<UIViewControllerAnimatedTransitioning>)navigationController:(UINavigationController *)navigationController
                                      animationControllerForOperation:(UINavigationControllerOperation)operation
                                                   fromViewController:(UIViewController *)fromVC
                                                     toViewController:(UIViewController *)toVC

Refer this link : https://developer.apple.com/library/ios/documentation/UIKit/Reference/UINavigationControllerDelegate_Protocol/index.html#//apple_ref/occ/intfm/UINavigationControllerDelegate/navigationController:animationControllerForOperation:fromViewController:toViewController : 请参阅以下链接: https : //developer.apple.com/library/ios/documentation/UIKit/Reference/UINavigationControllerDelegate_Protocol/index.html#//apple_ref/occ/intfm/UINavigationControllerDelegate/navigationController : animationControllerForOperation :fromViewController: toViewController

Example link : https://www.raywenderlich.com/86521/how-to-make-a-view-controller-transition-animation-like-in-the-ping-app 示例链接: https : //www.raywenderlich.com/86521/how-to-make-a-view-controller-transition-animation-like-in-the-ping-app

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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