簡體   English   中英

沒有情節提要segue迅速的過渡動畫

[英]Transition Animation without storyboard segue swift

我想在ViewController導航到另一個ViewController時更改動畫。 我正在使用情節提要,但未創建Segue。 使用storyboardID進行導航,我的導航代碼是:

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

現在,我想在導航期間更改過渡動畫。 我搜索了很多,但所有解決方案都是針對segue的。 有人可以幫忙更改動畫嗎?

您可以通過導航控制器委托來執行此操作,以在從UINavigationController對象的導航堆棧中推入或彈出視圖控制器時修改行為。

-navigationController:animationControllerForOperation:fromViewController:toViewController:

宣言:

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

請參閱以下鏈接: https : //developer.apple.com/library/ios/documentation/UIKit/Reference/UINavigationControllerDelegate_Protocol/index.html#//apple_ref/occ/intfm/UINavigationControllerDelegate/navigationController : animationControllerForOperation :fromViewController: toViewController

示例鏈接: 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