xcode 里面添加轉(zhuǎn)場(chǎng)動(dòng)畫(huà)

//MARK: - 按鈕點(diǎn)擊
extension FirstViewController{

    func buttonAction() {
        /*
        //轉(zhuǎn)場(chǎng)動(dòng)畫(huà),就是界面切換的時(shí)候的動(dòng)畫(huà)效果。
        //1.添加轉(zhuǎn)場(chǎng)動(dòng)畫(huà)
        //a.創(chuàng)建轉(zhuǎn)場(chǎng)動(dòng)畫(huà)對(duì)象
        let animation = CATransition.init()
        //b.設(shè)置動(dòng)畫(huà)時(shí)間
        animation.duration = 0.4
        //c.設(shè)置動(dòng)畫(huà)類(lèi)型
        //"rippleEffect"
        animation.type = "oglFlip"
        //d.設(shè)置動(dòng)畫(huà)方向
        animation.subtype = kCATransitionFromRight
        //e.添加動(dòng)畫(huà)
        //可以通過(guò)任何已經(jīng)顯示在界面上的視圖去拿到當(dāng)前應(yīng)用程序的window(主窗口)
        self.view.superview?.layer.addAnimation(animation, forKey: nil)
         */
        self.view.addTransitionAnimation(0.4, type: TransitionType.RippleEffect, direction: TransitionDirection.FromTop)
    
        //2.跳轉(zhuǎn)到下一個(gè)界面
        let second = SecondViewController()
        self.presentViewController(second, animated: false, completion: nil)
    }
}

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀(guān)點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

推薦閱讀更多精彩內(nèi)容