iOS - Calling App Delegate method from ViewController

前端 未结 13 950
鱼传尺愫
鱼传尺愫 2020-11-28 00:29

What I am trying to do is click a button (that was created in code) and have it call up a different view controller then have it run a function in the new view controller.

13条回答
  •  囚心锁ツ
    2020-11-28 01:27

    You can add #define uAppDelegate (AppDelegate *)[[UIApplication sharedApplication] delegate] in your project's Prefix.pch file and then call any method of your AppDelegate in any UIViewController with the below code.

    [uAppDelegate showLoginView];
    

提交回复
热议问题