Hello
I'm trying to change navigation bar background color this way
public override void ViewDidAppear (bool animated) { this.NavigationController.NavigationBar.TintColor = UIColor.Red; base.ViewDidAppear (animated); }
and getting an error
System.InvalidCastException: Cannot cast from source type to destination type. at at (wrapper castclass) object:__castclass_with_cache (object,intptr,intptr) at MonoTouch.ObjCRuntime.Runtime.ConstructNSObject[UINavigationBar] (IntPtr ptr, System.Type type, MissingCtorResolution missingCtorResolution) [0x00000] in :0 at MonoTouch.ObjCRuntime.Runtime.GetNSObject[UINavigationBar] (IntPtr ptr) [0x00000] in :0 at MonoTouch.UIKit.UINavigationController.get_NavigationBar () [0x00008] in /Developer/MonoTouch/Source/monotouch/src/UIKit/.pp-UINavigationController.g.cs:391 at UltimaReportiOS.LoginViewController.ViewDidAppear (Boolean animated) [0x00013] in /Users/ershovd/Ultima/projects/branches/UltimaSigneeReport/UltimaReport/UltimaReportiOS/LoginViewController.cs:82 at at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr) at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/.pp-UIApplication.cs:38 at UltimaReportiOS.Application.Main (System.String[] args) [0x00008] in /Users/ershovd/Ultima/projects/branches/UltimaSigneeReport/UltimaReport/UltimaReportiOS/Main.cs:16
I tried to do it in this way (as is showen here http://forums.xamarin.com/discussion/comment/35665/)
public override void ViewDidAppear (bool animated) { this.NavigationItem.HidesBackButton = true; UINavigationBar.Appearance.TintColor = UIColor.Red; base.ViewDidAppear (animated); }
No error, but also no color changes.
PS On simulator first way didn't raise any errors, but color didn't change too.
Any ideas?