When you create a new project, I seem to remember you being able to access the basic blank window it creates in the storyboard using self.window in the AppDelegate methods.
I can't seem to set a reference outlet to the AppDelegate.h file via the storyboard either. Am I just hallucinating or is there no way to access the window/controller from AppDelegate?
Am I mixing up iOS and OSX practices?
Using storyboards, it seems impossible to connect the WindowController to AppDelegate. I used the following to get a reference to the main window:
AppDelegate.h
@property (weak) NSWindow* window;
AppDelegate.m
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
_window = [[[NSApplication sharedApplication] windows] firstObject];
}
See this question for swift solution. Hope this helps :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With