Hi all, I'm slowly picking up Objective-C and the iPhoneSDK but I'm having some problems getting my head around the MVC pattern.
I'm fleshing out a game which I hope will have screens like a splash screen, title, help etc. What I'm currently doing is creating a new UIViewController and a new nib for each of these screens, is this the right practice? In the main AppDelegate I've created methods that show the views and add them with [window addSubView:controller.view]. What I'm finding is that with the show/hide code sat in the AppDelegate, I have to create a reference of the AppDelegate in the loaded controller in order to target the hide code. This seems a bit awkward but I expect I'm probably approaching this wrong, how do you guys usually do this sort of thing?
// example from AppDelegate
-(IBAction)showHelp:(id)sender
{
helpScreen = [[helpController alloc] initWithNibName:@"helpView" bundle:nil];
// send copy of self in order to target closeHelp method from InterfaceBuilder
helpScreen.appDel = self;
helpScreen.view.alpha = 0;
[window addSubview:helpScreen.view];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0];
helpScreen.view.alpha = 1.0;
[UIView commitAnimations];
}
Many Thanks,