How do I access my viewController from my appDelegate? iOS

后端 未结 6 2241
遇见更好的自我
遇见更好的自我 2020-11-28 05:31

I have an iOS app I created as a \"view-based app\" in xCode. I have only one viewController, but it is displayed automatically, and I see no code that ties it to my appDel

6条回答
  •  误落风尘
    2020-11-28 05:48

    Since you only have one view controller, the generic way (independent of how your app was set up):

    UIViewController *vc = [[[UIApplication sharedApplication] keyWindow] rootViewController];
    

提交回复
热议问题