I have two tab controllers on my delegate and I would like to switch them appear as needed. RootController is displayed as default and when I would like to display secondController from another class I use,
myAppDelegate *appDelegate = (myAppDelegate *)[[UIApplication sharedApplication] delegate];
[appDelegate.window addSubview:appDelegate.secondController.view];
[appDelegate.rootController.view removeFromSuperview];
problem is when I am trying to go back using same method. Crashes due to bad acces exception…
myAppDelegate *appDelegate = (myAppDelegate *)[[UIApplication sharedApplication] delegate];
[appDelegate.window addSubview:appDelegate.rootController.view];
[appDelegate.secondController.view removeFromSuperview];
Any help would be appreciated. Thank you.
You should not remove the rootController From Superview. Remove that line
and when you want to go back to your rootController just add the following lines: