ホーム

iOS - presentで横に画面遷移 Swift3 Swift4

実装

        let nextvc = nextvcViewController()
        nextvc.view.backgroundColor = UIColor.red
        let transition = CATransition()
        transition.duration = 0.5
        transition.type = kCATransitionPush
        transition.subtype = kCATransitionFromRight
        view.window!.layer.add(transition, forKey: kCATransition)
        self.present(nextvc, animated: false, completion: nil)

参照

How to present view controller from right to left in iOS using Swift

Swift3 – PresentsViewControllerで左右に画面遷移する方法

 

 

追記

これでもいける

        let storyboard: UIStoryboard = self.storyboard!
        let nextView = storyboard.instantiateViewController(withIdentifier: "EditTextViewController")
        let transition = CATransition()
        transition.duration = 0.5
        transition.type = kCATransitionPush
        transition.subtype = kCATransitionFromRight
        view.window!.layer.add(transition, forKey: kCATransition)
        present(nextView, animated: true, completion: nil)
Pocket
LinkedIn にシェア



新規webサービスの開発の依頼ならoffテク⭐️

低コストで、Reactなどモダン言語での新規webサービス開発を承ります

-ホーム

Copyright© off , 2020 All Rights Reserved Powered by AFFINGER5.