I’m still getting used to the whole “Controller” flow of iPhone development.
I’m using MonoTouch to build my app.
So my rootController is a TabBarController set in AppDelegate.
tabBarController = new UITabBarController ();
tabBarController.ViewControllers = new UIViewController [] {
mapView,
items,
account
};
In one of my view’s however, I’d like to have a UINavigationControl, so that people can click on items, then have the option to go back.
So here’s my constructor for my MapView.
public MapViewController () : base ("MapViewController", null)
{
Title = "Map";
TabBarItem.Image = UIImage.FromBundle ("Images/first");
}
So how do I add other types of ViewControllers at this point?
Instead of using your
MapViewControllerin the tab bar, just add aUINavigationControllerinstead.On that you then push the
MapViewController. If yourMapViewControllerpushes then another controller on top of theUINavigationController‘s stack, theUINavigationControllerwill handle the “go back” work for you by providing a button in its top toolbar, aUINavigationItem.You might want to read into the documentation of
UINavigationControllerand all the samples around.