Objective C: How to present modal view controller from appdelegate?

前端 未结 1 1808
走了就别回头了
走了就别回头了 2021-02-06 10:15

I am in the appdelegate of my application. How can I add a modal view controller in the \"didfinishlaunching\" method?

I tried the following but did not work

<         


        
相关标签:
1条回答
  • 2021-02-06 10:47

    Assuming tabController and navigationController are not nil, the applicationDidFinishLaunching may be too soon to display the modal view controller.

    1. Make sure you put that code after you make the window key and visible. [self.window makeKeyAndVisible];
    2. If that does not work try listening for the UIWindowDidBecomeKeyNotification for that window
    3. You can try delaying presentation of that modal a few seconds using performSelector:withObject:afterDelay:
    0 讨论(0)
提交回复
热议问题