Search code examples
cocoanswindowappkit

opening and closing a window programmatically in cocoa


I have two nibs in my project. I have been digging around the interwebs to figure out how to make a button close or hide the nib that the button is on and open another one. The other nib would have a button that does the same thing but in vice versa.

I don't have the faintest idea where to start with this. IF someone could just make a sample class and methods for this i might have something to work with.


Solution

  • Remove window from the screen

    [window close];


    Hide the window (doesn't release it)

    [window orderOut:self];
    

    Move the window to the front of its level in the screen list (= show window)

    [window orderFront:self];
    

    Check out