问题
New to MonoTouch and MonoTouch.Dialog, but I'm sure it's possible to create a tab bar or button bar or what you want to call it - the black bar with icons/buttons at the bottom of the iPhone. Question is how to do it with MonoTouch.Dialog?
Thanks for any help!
回答1:
You don't do it with MT.Dialog. You would create a UITabBarController, and then assign a view controller to each of it's tabs. Each tab could point to a MT.Dialog DialogViewController, or any other type of ViewController.
回答2:
Here's some code to show how easy it can be:
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;
}
to give you something like:
来源:https://stackoverflow.com/questions/9297348/tab-bar-at-the-bottom-with-monotouch-dialog