How do I do a Fade/No transition between view controllers

前端 未结 10 750
时光取名叫无心
时光取名叫无心 2020-12-07 08:48

Is it possible to do a fade in and fade out transition between View Controllers in Storyboard. Or without transition.

If it\'s possible, what\'s the code for it?

10条回答
  •  抹茶落季
    2020-12-07 09:16

    My Swift Version with optional checking offcourse!

        let storyboard = UIStoryboard.init(name: "Main", bundle: nil)
        if let stView = storyboard.instantiateViewControllerWithIdentifier("STVC") as? STVC {
            stView.modalTransitionStyle = UIModalTransitionStyle.CrossDissolve
            self.navigationController?.presentViewController(stView, animated: true, completion: nil)
        }
    

    Just make sure to set the Storyboard ID of the "View controller" in IB

提交回复
热议问题