Dismiss and Present View Controller in Swift

前端 未结 5 682
生来不讨喜
生来不讨喜 2020-12-09 11:52

Hi I\'m trying to present a viewcontroller and dismiss my current modal view but this code is not working

self.dismissViewControllerAnimated(true, completion         


        
5条回答
  •  心在旅途
    2020-12-09 12:21

    Here's a solution for Swift3

    To present the ViewController

    let NotificationVC = self.storyboard?.instantiateViewController(withIdentifier: "NotificationVC") as! ExecutiveNotificationViewController
    
    self.present(NotificationVC, animated: true, completion: nil)
    

    To dismiss the ViewController:

    self.dismiss(animated: true, completion: nil)
    

提交回复
热议问题