2011-10-28 35 views
2

我還是習慣了iPhone開發的整個「控制器」流程。如何將UINaivgationBar添加到屬於TabBarController的視圖

我正在使用MonoTouch構建我的應用程序。

所以我的rootController是在AppDelegate中設置的TabBarController。

 tabBarController = new UITabBarController(); 
     tabBarController.ViewControllers = new UIViewController [] { 
      mapView, 
      items, 
      account 
     }; 

在我的一個觀點的但是,我想有一個UINavigationControl,使人們可以點擊物品的話,還得回去的選項。

所以這裏是我的MapView的構造函數。

public MapViewController() : base ("MapViewController", null) 
    { 
     Title = "Map"; 
     TabBarItem.Image = UIImage.FromBundle ("Images/first"); 
    } 

那麼,如何在這一點上添加其他類型的ViewControllers的?

回答

3

而不是在標籤欄中使用您的MapViewController,而只需添加UINavigationController。 在那你然後推動MapViewController。如果您的MapViewController推動UINavigationController堆棧頂部的另一個控制器,UINavigationController將通過在其頂部工具欄中提供一個按鈕UINavigationItem來處理「返回」工作。

您可能想要閱讀UINavigationController以及所有樣本的文檔。

相關問題