I am using a custom Switch view controller and you would hope when switching between different views the “view did load” function or “view did finished loading” functions run but they do not.
Here what I am using:
- (IBAction)gotoKeyboardViews:(id)sender
{
YellowViewController *yellowController =
[[YellowViewController alloc]
initWithNibName:@"YellowViewController"
bundle:nil];
self.yellowViewController = yellowController;
[yellowController release];
[buttonKeyboard removeFromSuperview];
buttonStart = [UIButton buttonWithType:UIButtonTypeRoundedRect];
buttonStart.frame = CGRectMake(117,413, 103, 37);
[buttonStart setTitle:@"Restart" forState:UIControlStateNormal];
[buttonStart addTarget:self action:@selector(gotoBlueView:)
forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:buttonStart];
[blueViewController.view removeFromSuperview];
[self.view insertSubview:yellowViewController.view atIndex:0];
}
gotoKeyboardViews suppose to switch the views To YellowView From BlueView…But I think I am a little bit off about implementing the navbar. Please don’t tell me to go with the navbar because I don’t like their rigidness in design.
The
viewWillAppearmethod is executed as soon as the view gets active again. Maybe that’s the hook you are searching?Reference: Apple UIViewController Class Reference