can't wrap my head around this 
1. set up appDelegate and 2 view controllers. adds the first view controller on launch
2. inside the firstViewController.view, there is a button that will swap out the firstViewController.view for the secondViewController.view on the main window.
the swapping code will be in the appDelegate class
the problem is that i don't know how to call the appDelegate class from my firstViewController class
i've tried making instance variables of the appDelegate class inside my firstViewController class to call it that way, but it just doesn't get called (or crashes). the appDelegate class has instance variables of both the view controllers in order for it to know about them and call them, but it seems i can't include instance variables of the appDelegate within the 2 view controllers.
in Beginning iPhone Development (chapter 6: Multiview Applications) talks about this. if anyone is familiar with this chapter, do you know how to make this project work by removing the toolbar completely, and causing the views to switch by the buttons inside each of the views? here is the link to the book's source code, and the project is "06 View Switcher".
1. set up appDelegate and 2 view controllers. adds the first view controller on launch
Code:
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
[window addSubview:firstViewController.view];
[window makeKeyAndVisible];
}
2. inside the firstViewController.view, there is a button that will swap out the firstViewController.view for the secondViewController.view on the main window.
the swapping code will be in the appDelegate class
Code:
- (void)swapViews
{
[window insertSubview:secondViewController.view aboveSubview:firstViewController.view];
}
the problem is that i don't know how to call the appDelegate class from my firstViewController class
Code:
- (IBAction)buttonPressed
{
[[COLOR="Red"][I]whatGoesHere[/I][/COLOR] swapViews];
}
i've tried making instance variables of the appDelegate class inside my firstViewController class to call it that way, but it just doesn't get called (or crashes). the appDelegate class has instance variables of both the view controllers in order for it to know about them and call them, but it seems i can't include instance variables of the appDelegate within the 2 view controllers.
in Beginning iPhone Development (chapter 6: Multiview Applications) talks about this. if anyone is familiar with this chapter, do you know how to make this project work by removing the toolbar completely, and causing the views to switch by the buttons inside each of the views? here is the link to the book's source code, and the project is "06 View Switcher".