麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 學院 > 開發設計 > 正文

iOS開發——自定義轉場動畫

2019-11-14 18:46:03
字體:
來源:轉載
供稿:網友
首先是UipresentationController,這個控制器給modal新的viewController提供了下一步的view和轉場的管理,從一個viewController被modal出來到被dismiss,都是用UIPResentationController來管理視圖被展現的過程的各個方面。可以添加自定義動畫,對大小改變做出響應,并且可以管理其他viewController是如何顯示在屏幕的。
在初始化時,重寫
這個只讀屬性是被呈現的視圖所在的view,我們可以在這個view上添加其他視圖,通過
insertSubview(dummyView, atIndex: 0)這個方法。
接下來就用到兩個代理 UIViewControllerTransitioningDelegate和 UIViewControllerAnimatedTransitioning
實現代理方法,isPresented是一個是否被呈現的標記
// 返回負責轉場的控制器對象    func presentationControllerForPresentedViewController(presented: UIViewController, presentingViewController presenting: UIViewController, sourceViewController source: UIViewController) -> UIPresentationController? {        return PopoverPresentationController(presentedViewController: presented, presentingViewController: presenting)    }    // 返回提供modal動畫的對象    func animationControllerForPresentedController(presented: UIViewController, presentingController presenting: UIViewController, sourceController source: UIViewController) -> UIViewControllerAnimatedTransitioning? {        isPresented = true        return self    }    // 返回提供dismiss動畫的對象    func animationControllerForDismissedController(dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {        isPresented = false        return self    }    // 動畫時長    func transitionDuration(transitionContext: UIViewControllerContextTransitioning?) -> NSTimeInterval {        return 1.2    }    // 轉場動畫實現函數    func animateTransition(transitionContext: UIViewControllerContextTransitioning) {                }

 

在最后一個方法中實現轉場動畫的過程。
此外,還要設置
// 設置轉場動畫代理vc.transitioningDelegate = self// 將轉場動畫設置為自定義vc.modalPresentationStyle = UIModalPresentationStyle.Custom

 

否則,轉場動畫是無法自定義的。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 在线亚洲免费视频 | 免费a级黄色片 | chinesehd天美原创xxxx | 特级毛片a级毛片100免费 | 91九色视频在线播放 | 蜜桃视频在线免费播放 | 成人羞羞网站入口 | 日本aⅴ在线 | 色婷婷久久久久久 | 国产羞羞视频在线免费观看 | 久久99国产伦子精品免费 | 国产精品99久久久久久久女警 | 九九夜夜 | 手机av免费电影 | 久久精品视频在线看99 | 久草网在线 | 久久思思爱 | 欧美黄色一级片在线观看 | 日日草日日干 | 中文字幕一区在线观看视频 | 91午夜视频 | www.91sp| 一级视频网站 | 国产一级毛片国语版 | 亚洲午夜精品视频 | 久久精品9 | 涩涩操| 欧美日韩在线播放 | 免费网址黄 | 亚洲国产精品一区 | 色综合视频网 | 久久久婷婷一区二区三区不卡 | 草妞视频 | 一级毛片免费高清 | 久久99国产精品久久99果冻传媒 | www.91操| 久久久日韩av免费观看下载 | 免费国产在线观看 | 一区二区三区国产在线 | 369看片你懂的小视频在线观看 | 欧美性生活久久 |