I am implementing a UIViewController with ScrollView. In the centre of the view I have a ToolBar like that one in the picture:
I have four UIViewControllers to add, one for each button of the toolBar. I do not know if I should init all off them at the beginning and then with a NSArray of viewControllers and one NSArray of booleans manage all of them with this methods:
How could I manage this?? Change viewControllers at the bottom of the toolBar while any button is pressed
- (void) displayContentController: (UIViewController*) content;
{
scrollView.contentSize =CGSizeMake(scrollView.frame.size.width, self.view.frame.size.height + content.view.frame.size.height );
[self addChildViewController:content];
content.view.frame = [self frameForContentController];
[scrollView addSubview:content.view];
[content didMoveToParentViewController:self];
}
- (void) hideContentController: (UIViewController*) content
{
[content willMoveToParentViewController:nil]; // 1
[content.view removeFromSuperview]; // 2
[content removeFromParentViewController]; // 3
}
I have never used childViewControllers actually and I really do not know how to use them