【发布时间】:2012-02-25 08:13:23
【问题描述】:
我正在尝试更改导航栏控制器和标签栏控制器的颜色
我正在使用 monotouch.dialog 来构建我的应用程序并具有以下代码
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);
}
我打算在哪里改变颜色?让我改变顶部和底部?
【问题讨论】:
标签: c# ios xamarin.ios monodevelop monotouch.dialog