Call app delegate method from view controller

后端 未结 4 701
自闭症患者
自闭症患者 2021-01-01 17:57

I want to know if I can call an app delegate method from another ViewController.

When the app starts, the application(application: UIApplication, didFinishLaun

4条回答
  •  一生所求
    2021-01-01 18:03

    In Swift 3.0, you can call as:

    let appDelegate = UIApplication.shared.delegate as! AppDelegate
    appDelegate.anyAppDelegateInstaceMethod()
    

提交回复
热议问题