I have a project in which, there is root viewcontroller and multi sub viewcontrollers.
In root viewcontroller I call and switch between 2 sub viewcontrollers
codes as:
//root view controller controller button at front of all subviewcontrollers'view
[vViewController2.view removeFromSuperview];
[self.view insertSubview:vViewController1.view atIndex:0];
in this mode the sub view/viewcontroller in the memory will be unload, when it is loaded later, it will prompt the event of viewDidload.
But I prefer to after the sub viewcontroller is loaded and when switch, it stores in memory rather than unload from memory.
If did as this, I have to increate the value of atIndex.
When I try to return to the sub viewcontroller with low value of atIndex, I do not knwo how to do.
Welcome any comment
Thanks
interdev
Best Answer
Consider using standard solutions, i.e.
UINavigationController
orUITabBarController
depending of the hierarchy of your views - these standard classes will do a lot of work for you.