2
我试图改变一个导航栏控制器的颜色,也是一个使用MonoTouch.Dialog
我使用monotouch.dialog建立我的应用和标签栏控制器时,更改TabBarController&NavigationController有以下代码
public partial class AppDelegate : UIApplicationDelegate
{
// class-level declarations
UIWindow window;
//
// This method is invoked when the application has loaded and is ready to run. In this
// method you should instantiate the window, load the UI into it and then make the window
// visible.
//
// You have 17 seconds to return from this method, or iOS will terminate your application.
//
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
// create a new window instance based on the screen size
window = new UIWindow (UIScreen.MainScreen.Bounds);
// If you have defined a view, add it here:
// window.AddSubview (navigationController.View);
CreateTabs();
// make the window visible
window.MakeKeyAndVisible();
return true;
}
protected void CreateTabs()
{
window = new UIWindow (UIScreen.MainScreen.Bounds);
var nav = new UITabBarController();
nav.ViewControllers = new UIViewController [] {
new HomeController("Home"),
new WhereToUseController(),
new TransactionsController(),
new SettingsController()
};
// nav.TabBarController.TabBar.BackgroundColor = UIColor.Green;
nav.CustomizableViewControllers = new UIViewController [0];
window.RootViewController = nav;
// window.BackgroundColor = UIColor.Orange;
window.MakeKeyAndVisible();
}
我控制器
public override void LoadView()
{
base.LoadView();
//TableView.BackgroundColor = UIColor.Clear;
// ParentViewController.View.BackgroundColor = UIColor.Red;
}
public HomeController (string s)
{
TabBarItem = new UITabBarItem (s, null, 1);
var root = new RootElement (s) {
new Section() {
new UIViewElement("My Caption:", view, false),
new StyledStringElement("Hello","somevalue"),
new StringElement ("Welcome back Shane"),
new ImageElement(new UIImage("Images/QR.png")),
}
};
PushViewController (new DialogViewController (root), false);
}
我在哪里意味着要改变颜色的一个例子吗?让我改变顶部和底部?