Call app delegate method from view controller

后端 未结 4 732
自闭症患者
自闭症患者 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:05

    This method is called just once when app launches. You can't from ViewController. Instead make user defined method in AppDelegete. and call that method from ViewController. By getting object of AppDelegate.

    AppDelegate *appDel = (AppDelegate *)[UIApplication sharedApplication].delegate;
    [appDel ];
    

提交回复
热议问题