I am having a problem making a window appear programmatically…..
I have created the window in the interface builder and I have a window controller class
I have and IBOutlet NSWindow mywindow in the controller class that is bound to the window (via interface builder).
I have tried calling [mywindow display] and [mywindow makeKeyAndOrderFront:nil] but neither display the window.
If in the interface builder I set ‘Visible at Launch’, the window is visible when the application launches, but now I can’t hide it… calling [mywindow close] does nothing.
I think I have missed something pretty basic here but can’t work out what.
Are you sure you’re calling this code from within the IB window controller instance and not from a programmatically created instance? Try with
NSLog(@"%@",myWindow);to check whethermyWindowisnil.