OS X storyboard calls viewDidLoad before applicationDidFinishLaunching

前端 未结 4 788
野趣味
野趣味 2020-12-06 06:28

I created a Mac OS X application in Xcode using storyboards. For some reason the applicationDidFinishLaunching method in the AppDelegate is being called after <

4条回答
  •  时光说笑
    2020-12-06 06:52

    The other solution is registering NSApplicationDidFinishLaunchingNotification in your view controllers and move your code from viewDidLoad to applicationDidFinishLaunchingNotification:

    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(applicationDidFinishLaunchingNotification:)
                                                 name:NSApplicationDidFinishLaunchingNotification
                                               object:nil];
    

提交回复
热议问题