views:

360

answers:

5

I am a newbie in Mac application development. I want to write a GUI application in Cocoa using Interface Builder. I want multiple screens i.e. when one button on a screen is clicked, another screen should be displayed. How can I activate a new screen at button click event?

+1  A: 

I think what you want is the type of interface like that seen in Coda, or System Preferences where there is a toolbar on the top of the screen that can be used to select between the content of the window.

The simplest method I have found is to use BWToolkit.

Another method is to use a series of views, and switch between them when the toolbar is clicked. I've found one description here, but that's not the one I used first (which may have been originally in Ruby Cocoa, IIRC).

Matthew Schinckel
+2  A: 

The button has a target. That should link to the new window. As its action you can tell the window to show itself.

Take a look at: http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/WinPanel/WinPanel.html

Stephan Eggermont
+3  A: 

I would heartily recommend Aaron Hilegass's book Cocoa Programming for Mac OS X. It took me from feeling like everything was impossible to being relatively competent in the space of a few short weeks. I was very impressed with it.

Apple's documentation is amazingly good, but it takes a while to get used to the style, and you will need to know which objects actually exist before you can look up how to use them, which is where Aaron's book comes in.

Your library may have a copy of it, or be able to order one for you if they don't.

Jonathan
Apple's documentation is good when you know what you are looking for. Getting to know Objective-C and Mac Development first is a good start to knowing where to look for things in the docs.
Abizern
+2  A: 

I think you mean windows, not screens. Screens are the displays (monitors) on which all the user's windows from all the user's applications appear.

And I second Jonathan's recommendation of the Hillegass book.

Peter Hosey
A: 

NSTabView.

kent