Skip navigation.
 
mlChanging views from within another view
FROM : Wayne Pascoe
DATE : Fri Jul 04 04:02:57 2008

Hi all,

I think I've hacked myself into a corner and I could use some advice / 
clarity in getting out of it.

I am trying to build a tool that uses multiple views inside one window 
as well as additional windows when appropriate.

The code for changing between views (changeViewController and 
displayViewController) lives in the App Delegate class. This class has 
the outlet to the window that all the views are shown in. This class 
is also the delegate for the File's Owner in my main menu nib.

I then have NIBs for each different view. Each NIB has a corresponding 
viewcontroller class which is the class for the File's Owner of that 
NIB.

When the application launches an initial view is loaded and displayed 
in the window from within the App Delegate class. The problem I then 
have is that I can't work out how to change to another view. Any 
methods I try and use are sent to the viewcontroller class for that 
view and not the App Delegate.

The examples that I started out from all used a control outside of the 
view. For example, the view was loaded into a box in the window, and 
outside that box was an NSPopUp that you could use to switch views. I 
understand how this works, as this control sends messages to the App 
Delegate. This then has the code to change the view, and it also has 
the outlet to the window and the box, so it can update these.

Is there a way for the viewcontroller class to receive the change view 
request from the user and forward that to the App delegate class? Or 
is this the wrong way to do it?

Any pointers to reading on the correct way to do this would be greatly 
appreciated!

Thanks,
--
Wayne Pascoe    (gpg --keyserver www.co.uk.pgp.net --recv-keys 79A7C870)
Hanlon's Razor:
Never attribute to malice that which is adequately
explained by stupidity

Related mailsAuthorDate
mlChanging views from within another view Wayne Pascoe Jul 4, 04:02
mlRe: Changing views from within another view Cathy Shive Jul 4, 08:54