Hi all,I am building a multiview app and rather than having a root view controller with two subviews, I thought I'd try putting the view switching code into the app delegate as follows. However, it's not working. Is this a dumb thing to do? Should I always use a root view controller if I'm switching between two views? And what am I missing about the way that bringSubviewToFront works? My assumption was that if I had two views and added them both to the window, I could switch between the two views using this method, but either I'm doing it wrong, or I'm misunderstanding how that works. I do realize I don't get the benefit of lazy loading of the views, but because this app is so small, I thought that wouldn't matter much.
DesignMeditationsAppDelegate: - (void)applicationDidFinishLaunching:(UIApplication *)application { // Override point for customization after application launch [window addSubview:meditationViewController.view]; [window addSubview:aboutViewController.view]; [window bringSubviewToFront:meditationViewController.view]; [window makeKeyAndVisible]; } - (void) switchViews:(UIView *)aView { [window bringSubviewToFront:aView]; [window makeKeyAndVisible]; } One of the view controllers, MeditationViewController (the other one, AboutViewController has an analogous method): - (IBAction)switchToAboutView:(id)sender { NSLog(@"info button pressed"); DesignMeditationsAppDelegate *delegate = [[UIApplication sharedApplication] delegate]; [delegate switchViews:self.view]; } Thank you very much in advance! Elisabeth _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com