Reputation: 4341
If I create an OS X app using Xcode 6. What's the best way to programmatically access the UIWindow inside the Window Controller (that's instantiated from the Story Board).
More Info
What I'm trying to do is set the UIWindow.titleVisibility
property (in combination with the "Unified Title and Toolbar" option)
Solution
Using @Fr33g's advice, what I really needed to do was create a class based on NSWindowController
and set this as the Custom Class in the Story Board for the Window Controller object.
I was then able to override the windowDidLoad
and access the window
object in there to set the titleVisibility
property.
The toolbar now displays in line with the window controls!
Upvotes: 1
Views: 799
Reputation: 2279
Do you want to access the view of a ViewController or what's actually your intention? I'm not aware of a WindowController, but of ViewControllers. However you can get an array with all UIWindow objects associated to your app by using:
[UISharedApplication sharedApplication].windows
The windows are ordered from back to front by the window level. Nevertheless I'm not quite sure what you want to do. Perhaps you could be a little more precise.
If you instantiate a ViewController from the storyboard, you can access the view by simply using:
yourViewController.view
Upvotes: 1