So, I have two kinds. When I launch the application, you view the loads. Then, when I click the button on this view, it loads another view.
- (IBAction)triggerGame { leveldata = [[NSMutableDictionary alloc] init]; [leveldata setValue:@"hide" forKey:@"shootarrow"]; [leveldata writeToFile:[self levelFilePath] atomically:YES]; [leveldata release]; Papertoss_MaraAppDelegate *mainDelegate = (Papertoss_MaraAppDelegate *)[[UIApplication sharedApplication] delegate]; [mainDelegate playGame]; }
This action calls a method in the delegate implementation called playGame, which looks like this:
- (void)playGame { [levelView.view removeFromSuperview]; [self.window addSubview:[gameView view]]; [UIView commitAnimations]; }
It loads a new view very simply. Then I have another button that does the same thing, but returns me to the first view. And that also works great. I can easily move from one sight to another. But the only problem I encountered is when I try to load the second view a second time, viewDidLoad is not called again. I checked this with NSLog () in the viewDidLoad method.
For my application to do what I need, I need to call viewDidLoad again. I assume that my gaze is not completely unloaded when I switch between them.
Any help is appreciated.
iphone cocoa-touch uikit ipad viewdidload
Kevin peters
source share