I have a segmented control in a View controller.
I want to load a different view into the middle when segments are tapped. Effectively making it a tab bar controller. (Q: why not just use a tab bar controller, A: I already have one)
Here are my requirements:
I want to use view controllers everywhere. One 'super view controller' to manage the segmented control. Two 'sub view controllers' to display the content when the segmented control is tapped.
I want view did load / unload and other messages to come the the sub view controllers that you would expect.
I want a neat, elegant solution. Minimal hacking.
My current implementation fails on point 2:
- (IBAction)valueChanged:(id)sender {
switch (self.segmentedControl.selectedSegmentIndex) {
case 0:
{
ThirdVC* vc = [[ThirdVC alloc] initWithNibName:@"ThirdVC"
bundle:nil];
[self.centerView addSubview:vc.view];
}
break;
... etc