NSViewController and View Swapping
NSViewController and View Swapping
- Subject: NSViewController and View Swapping
- From: Brad Gibbs <email@hidden>
- Date: Sun, 13 Jul 2008 22:15:21 -0700
I'm trying to create a Cocoa app with a single window with a number of
views that get swapped in and out, using an NSViewController for each
of the views.
I have a series of buttons along the bottom of the UI in a custom
view, and another custom view above the row of buttons. When button A
is pressed, view A should appear in the custom view above the row of
buttons, and button A should be turned on. When button B is pressed,
view A should be replaced by View B, button A should turn off and
button B should turn on. Ultimately, I'd like to do this with an
animation (view A fades out and view B fades in). For now, I'd be
happy just replacing A with B.
I haven't been able to find much in the documentation about
NSViewController for Cocoa. I have the Hillegass book, but the view
swapping example in Chapter 29 is done with a document-based
application and the views there are contained in an NSBox:
...
NSView *v = [vc view];
[box setContentView:v];
...
I don't know Cocoa well enough to adapt this example for a non-
document-based application without an NSBox. Could someone please
point me to documentation for NSViewController, other than the
NSViewController Reference, or provide me with a quick explanation or
example code that will do this? I've read through the Katidev blog on
XSViewController and XSWindowController, but, again, that's a document-
based example, and it doesn't explicitly provide methods for replacing
one view with another.
Thanks in advance.
Brad
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden