private static void SetApperance(UINavigationBar.UINavigationBarAppearance bar, UIImage backgroundImg, UIColor color) { bar.TintColor = UIColor.White; bar.BarTintColor = bar.BackgroundColor = color; bar.SetBackgroundImage(backgroundImg, UIBarMetrics.Default); bar.SetTitleTextAttributes(new UITextAttributes { TextColor = UIColor.White, Font = UIFont.SystemFontOfSize(18f) }); bar.BackIndicatorImage = Images.Buttons.Back; bar.BackIndicatorTransitionMaskImage = Images.Buttons.Back; }
/// <summary> /// Apply this theme to a specific view. /// </summary> /// <param name="options"> /// "blue", or null /// </para> public static void Apply (UINavigationBar view, string options = null) { if (options == "blue") { view.SetBackgroundImage (blueNavigationBarBackground.Value, UIBarMetrics.Default); } else { view.SetBackgroundImage (navigationBarBackground.Value, UIBarMetrics.Default); } view.SetTitleTextAttributes (new UITextAttributes { TextColor = UIColor.FromRGBA (255, 255, 255, 255), TextShadowColor = UIColor.FromRGBA (0, 0, 0, 0.8f), TextShadowOffset = new UIOffset (0, -1), }); }
/// <summary> /// Apply this theme to a specific view. /// </summary> /// <param name="options"> /// "blue", or null /// </para> public static void Apply(UINavigationBar view, string options = null) { if (options == "blue") { view.SetBackgroundImage(blueNavigationBarBackground.Value, UIBarMetrics.Default); } else { view.SetBackgroundImage(navigationBarBackground.Value, UIBarMetrics.Default); } view.SetTitleTextAttributes(new UITextAttributes { TextColor = UIColor.FromRGBA(255, 255, 255, 255), TextShadowColor = UIColor.FromRGBA(0, 0, 0, 0.8f), TextShadowOffset = new UIOffset(0, -1), }); }
public static void SetFlatNavigationBarAppearance(UINavigationBar.UINavigationBarAppearance appearance, UIColor color, UIColor textColor) { UIImage backgroundImage = FlatUI.Image(color, 0); appearance.SetBackgroundImage(backgroundImage, UIBarMetrics.Default); appearance.SetBackgroundImage(backgroundImage, UIBarMetrics.LandscapePhone); UITextAttributes titleTextAttributes = appearance.GetTitleTextAttributes(); if (titleTextAttributes == null) titleTextAttributes = new UITextAttributes(); titleTextAttributes.TextShadowColor = UIColor.Clear; titleTextAttributes.TextShadowOffset = new UIOffset(0, 0); titleTextAttributes.TextColor = textColor; titleTextAttributes.Font = FlatUI.BoldFontOfSize(0); appearance.SetTitleTextAttributes(titleTextAttributes); if (appearance.RespondsToSelector(new MonoTouch.ObjCRuntime.Selector("setShadowImage:"))) appearance.ShadowImage = FlatUI.Image(UIColor.Clear, 0); }
public static void Apply (UINavigationBar.UINavigationBarAppearance appearance, string options = null) { if (IsModern) return; appearance.TintColor = BarTintColor; appearance.SetTitleVerticalPositionAdjustment (-1, UIBarMetrics.Default); appearance.SetTitleVerticalPositionAdjustment (-4, UIBarMetrics.LandscapePhone); appearance.SetTitleTextAttributes (new UITextAttributes { TextColor = BarTextColor, TextShadowColor = BarTextShadowColor, TextShadowOffset = BarTextShadowOffset, Font = UIFont.FromName (TitleFontName, BarTitleFontSize), }); }
/// <summary> /// Apply this theme to all views with the given appearance. /// </summary> /// <param name="options"> /// "blue", or null /// </para> public static void Apply(UINavigationBar.UINavigationBarAppearance appearance, string options = null) { if (options == "blue") appearance.SetBackgroundImage (blueNavigationBarBackground.Value, UIBarMetrics.Default); else appearance.SetBackgroundImage (navigationBarBackground.Value, UIBarMetrics.Default); appearance.SetTitleTextAttributes (new UITextAttributes { TextColor = UIColor.FromRGBA (255, 255, 255, 255), TextShadowColor = UIColor.FromRGBA (0f, 0f, 0f, 0.8f), TextShadowOffset = new UIOffset (0f, -1f) }); }