2012-02-15 91 views
3

MonoTouch和MonoTouch.Dialog是新手,但我確定可以創建一個標籤欄或按鈕欄或者您想調用它的地方 - iPhone底部帶有圖標/按鈕的黑色欄。問題是如何用MonoTouch.Dialog做到這一點?帶有MonoTouch.Dialog底部的標籤欄?

感謝您的幫助!

回答

4

你不用MT.Dialog來做。您將創建一個UITabBarController,然後將視圖控制器分配給它的每個選項卡。每個選項卡可以指向一個MT.Dialog DialogViewController或任何其他類型的ViewController。

9

下面是一些代碼來顯示它多麼容易:

class MyViewController : UINavigationController { 

     public MyViewController (string s) 
     { 
      TabBarItem = new UITabBarItem (s, null, 1); 
      var root = new RootElement (s) { 
       new Section (s) { 
        new StringElement (s) 
       } 
      }; 
      PushViewController (new DialogViewController (root), false); 
     } 
    } 

    public override bool FinishedLaunching (UIApplication app, NSDictionary options) 
    { 
     window = new UIWindow (UIScreen.MainScreen.Bounds); 

     var nav = new UITabBarController(); 
     nav.ViewControllers = new UIViewController [] { 
      new MyViewController ("a"), 
      new MyViewController ("b"), 
      new MyViewController ("c") 
     }; 
     nav.CustomizableViewControllers = new UIViewController [0]; 

     window.RootViewController = nav; 
     window.MakeKeyAndVisible(); 
     return true; 
    } 

給你這樣的:

screenshot