I have a tabbar -> navigationcontroller structure. In one of these tabs, I want to switch between two UIViewControllers (a KalViewController and a UITableViewController to be be exact), using a UISegmentedControl located in the Navigation Bar.
Currently, I have a third UIViewController, that pops and pushes the appropriate ViewControllers on segment value change. I don't think thats the right way to do it and it also destroys the navigation stack (when I tap on the bar item, the navigation controller goes the root controller, which won't work). And there's even another bug, related to the Kal Component.
So, what's the right way to do it?
The right way to do it is to have the controller handling the
UISegmentedControl
add the views of the controllers as subviews.It's your responsibility to send
viewWillAppear:
and so on.EDIT: The offset you're talking about can be adjusted using:
EDIT 2: In response to tc.'s comment:
From the documentation of
UISplitViewController
:Message Forwarding to Its Child View Controllers
This is not magical and there is no reason why you wouldn't be able to write a similar controller yourself. In fact I've done it and it worked just fine.