public override void ViewDidLoad() { base.ViewDidLoad(); base.TableView.DataSource = this.dataSource; // Note that images configured as the back bar button's background do // not have the current tintColor applied to them, they are displayed as it. var backButtonBackgroundImage = UIImage.FromBundle("Menu"); // The background should be pinned to the left and not stretch. backButtonBackgroundImage = backButtonBackgroundImage.CreateResizableImage(new UIEdgeInsets(0f, backButtonBackgroundImage.Size.Width - 1f, 0f, 0f)); var barAppearance = UINavigationBar.AppearanceWhenContainedIn(typeof(CustomBackButtonNavController)); barAppearance.BackIndicatorImage = backButtonBackgroundImage; barAppearance.BackIndicatorTransitionMaskImage = backButtonBackgroundImage; // Provide an empty backBarButton to hide the 'Back' text present by // default in the back button. // // NOTE: You do not need to provide a target or action. These are set // by the navigation bar. // NOTE: Setting the title of this bar button item to ' ' (space) works // around a bug in iOS 7.0.x where the background image would be // horizontally compressed if the back button title is empty. var backBarButton = new UIBarButtonItem(" ", UIBarButtonItemStyle.Plain, null); base.NavigationItem.BackBarButtonItem = backBarButton; }
// // 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) { //Set the status bar if (Util.iOSVersion.Item1 < 6) { UIApplication.SharedApplication.SetStatusBarStyle(UIStatusBarStyle.BlackOpaque, false); } else { UIApplication.SharedApplication.SetStatusBarStyle(UIStatusBarStyle.BlackTranslucent, false); } if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { var textAttrs = new UITextAttributes() { TextColor = UIColor.White, TextShadowColor = UIColor.DarkGray, TextShadowOffset = new UIOffset(0, -1) }; UINavigationBar.Appearance.SetTitleTextAttributes(textAttrs); UISegmentedControl.Appearance.SetTitleTextAttributes(textAttrs, UIControlState.Normal); } //Set the theming UIBarButtonItem.Appearance.SetBackButtonBackgroundImage(Images.Controls.BackButton.CreateResizableImage(new UIEdgeInsets(0, 16, 0, 10)), UIControlState.Normal, UIBarMetrics.Default); UIBarButtonItem.AppearanceWhenContainedIn(typeof(UIPopoverController)).SetBackButtonBackgroundImage(null, UIControlState.Normal, UIBarMetrics.Default); UIBarButtonItem.Appearance.SetBackgroundImage(Images.Controls.Button, UIControlState.Normal, UIBarMetrics.Default); UIBarButtonItem.AppearanceWhenContainedIn(typeof(UIPopoverController)).SetBackgroundImage(null, UIControlState.Normal, UIBarMetrics.Default); UINavigationBar.Appearance.SetBackgroundImage(Images.Controls.Navbar.CreateResizableImage(new UIEdgeInsets(0, 0, 0, 0)), UIBarMetrics.Default); UINavigationBar.AppearanceWhenContainedIn(typeof(UIPopoverController)).SetBackgroundImage(null, UIBarMetrics.Default); UIToolbar.Appearance.SetBackgroundImage(Images.Controls.Navbar.CreateResizableImage(new UIEdgeInsets(0, 0, 0, 0)), UIToolbarPosition.Any, UIBarMetrics.Default); Window = new UIWindow(UIScreen.MainScreen.Bounds); SlideController = new SlideoutNavigationController(); Window.RootViewController = SlideController; SlideController.SelectView(new RecentPatternsViewController()); Window.MakeKeyAndVisible(); if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone) { UIImageView killSplash = null; if (IsTall) { killSplash = new UIImageView(UIImageHelper.FromFileAuto("Default-568h")); } else { killSplash = new UIImageView(UIImageHelper.FromFileAuto("Default")); } Window.AddSubview(killSplash); Window.BringSubviewToFront(killSplash); UIView.Animate(0.8, () => killSplash.Alpha = 0.0f, killSplash.RemoveFromSuperview); } return(true); }
public static void Setup() { UIGraphics.BeginImageContext(new CoreGraphics.CGSize(1, 64f)); Theme.PrimaryNavigationBarColor.SetFill(); UIGraphics.RectFill(new CoreGraphics.CGRect(0, 0, 1, 64)); var img = UIGraphics.GetImageFromCurrentImageContext(); UIGraphics.EndImageContext(); UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.LightContent; var navBarContainers = new [] { typeof(MenuNavigationController), typeof(ThemedNavigationController), typeof(MainNavigationController) }; foreach (var navbarAppearance in navBarContainers.Select(x => UINavigationBar.AppearanceWhenContainedIn(x))) { navbarAppearance.TintColor = Theme.PrimaryNavigationBarTextColor; navbarAppearance.BarTintColor = Theme.PrimaryNavigationBarColor; navbarAppearance.BackgroundColor = Theme.PrimaryNavigationBarColor; navbarAppearance.SetTitleTextAttributes(new UITextAttributes { TextColor = Theme.PrimaryNavigationBarTextColor, Font = UIFont.SystemFontOfSize(18f) }); navbarAppearance.SetBackgroundImage(img, UIBarPosition.Any, UIBarMetrics.Default); navbarAppearance.BackIndicatorImage = Images.BackButton; navbarAppearance.BackIndicatorTransitionMaskImage = Images.BackButton; } UISegmentedControl.Appearance.TintColor = UIColor.FromRGB(110, 110, 117); UISegmentedControl.AppearanceWhenContainedIn(typeof(UINavigationBar)).TintColor = UIColor.White; UISwitch.Appearance.OnTintColor = UIColor.FromRGB(0x41, 0x83, 0xc4); // Composer Input Accessory Buttons UIButton.AppearanceWhenContainedIn(typeof(UIScrollView)).TintColor = Theme.PrimaryNavigationBarColor; //UITableViewHeaderFooterView.Appearance.TintColor = UIColor.FromRGB(228, 228, 228); var headerFooterContainers = new [] { typeof(UITableViewHeaderFooterView) }; foreach (var navbarAppearance in headerFooterContainers) { UILabel.AppearanceWhenContainedIn(navbarAppearance).TextColor = UIColor.FromRGB(110, 110, 117); UILabel.AppearanceWhenContainedIn(navbarAppearance).Font = UIFont.SystemFontOfSize(14f); } StringElement.DefaultTintColor = Theme.PrimaryNavigationBarColor; UIToolbar.Appearance.BarTintColor = UIColor.FromRGB(245, 245, 245); UIBarButtonItem.AppearanceWhenContainedIn(typeof(UISearchBar)).SetTitleTextAttributes(new UITextAttributes { TextColor = UIColor.White }, UIControlState.Normal); }
/// <summary> /// Sets the theme of the application. /// </summary> private void SetTheme() { //Set the status bar UIApplication.SharedApplication.SetStatusBarStyle(UIStatusBarStyle.BlackOpaque, false); UIToolbar.Appearance.SetBackgroundImage(Images.Components.Toolbar.CreateResizableImage(new UIEdgeInsets(0, 0, 0, 0)), UIToolbarPosition.Bottom, UIBarMetrics.Default); var textAttrs = new UITextAttributes { TextColor = UIColor.White, TextShadowColor = UIColor.FromRGB(40, 40, 40), TextShadowOffset = new UIOffset(0, 1) }; UINavigationBar.Appearance.SetTitleTextAttributes(textAttrs); UISearchBar.Appearance.BackgroundImage = Images.Components.Searchbar.CreateResizableImage(new UIEdgeInsets(0, 1f, 0, 1f)); UINavigationBar.Appearance.SetBackgroundImage(Images.Components.TopNavbar.CreateResizableImage(new UIEdgeInsets(0, 0, 0, 0)), UIBarMetrics.Default); UINavigationBar.AppearanceWhenContainedIn(typeof(UIPopoverController)).SetBackgroundImage(null, UIBarMetrics.Default); }
public static void Setup() { var theme = new Theme(); CurrentTheme = theme; Theme.CurrentTheme = theme; var backgroundImg = CreateBackgroundImage(Theme.CurrentTheme.PrimaryColor); var barTypes = new [] { typeof(MainNavigationController), typeof(ThemedNavigationController) }; foreach (var bar in barTypes.Select(x => UINavigationBar.AppearanceWhenContainedIn(x))) { SetApperance(bar, backgroundImg, Theme.CurrentTheme.PrimaryColor); } var menuColor = UIColor.FromRGB(50, 50, 50); var menuImg = CreateBackgroundImage(menuColor); var menuApp = UINavigationBar.AppearanceWhenContainedIn(typeof(MenuNavigationController)); SetApperance(menuApp, menuImg, menuColor); foreach (var buttonItem in barTypes.Select(x => UIBarButtonItem.AppearanceWhenContainedIn(x))) { buttonItem.SetBackButtonTitlePositionAdjustment(new UIOffset(0, -64), UIBarMetrics.LandscapePhone); buttonItem.SetBackButtonTitlePositionAdjustment(new UIOffset(0, -64), UIBarMetrics.Default); } UISegmentedControl.AppearanceWhenContainedIn(typeof(UIToolbar)).TintColor = Theme.CurrentTheme.PrimaryColor; UITableViewHeaderFooterView.Appearance.TintColor = UIColor.FromRGB(228, 228, 228); UILabel.AppearanceWhenContainedIn(typeof(UITableViewHeaderFooterView)).TextColor = UIColor.FromRGB(136, 136, 136); UILabel.AppearanceWhenContainedIn(typeof(UITableViewHeaderFooterView)).Font = UIFont.SystemFontOfSize(13f); UIToolbar.Appearance.BarTintColor = UIColor.FromRGB(245, 245, 245); UIBarButtonItem.AppearanceWhenContainedIn(typeof(UISearchBar)).SetTitleTextAttributes(new UITextAttributes { TextColor = UIColor.White }, UIControlState.Normal); UIImageView.AppearanceWhenContainedIn(typeof(UITableViewCell), typeof(MainNavigationController)).TintColor = Theme.CurrentTheme.IconColor; EmptyListView.DefaultColor = Theme.CurrentTheme.PrimaryColor; }
public static void Setup() { UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.LightContent; var menuNavBarBackground = CreateBackgroundImage(Theme.PrimaryMenuNavigationBarColor); var menuNavBarContainer = UINavigationBar.AppearanceWhenContainedIn(typeof(MenuNavigationController)); menuNavBarContainer.TintColor = Theme.PrimaryMenuNavigationBarTextColor; menuNavBarContainer.BarTintColor = Theme.PrimaryMenuNavigationBarColor; menuNavBarContainer.BackgroundColor = Theme.PrimaryMenuNavigationBarColor; menuNavBarContainer.SetTitleTextAttributes(new UITextAttributes { TextColor = Theme.PrimaryMenuNavigationBarTextColor, Font = UIFont.SystemFontOfSize(18f) }); menuNavBarContainer.SetBackgroundImage(menuNavBarBackground, UIBarPosition.Any, UIBarMetrics.Default); menuNavBarContainer.BackIndicatorImage = Images.BackButton; menuNavBarContainer.BackIndicatorTransitionMaskImage = Images.BackButton; UISegmentedControl.Appearance.TintColor = UIColor.FromRGB(110, 110, 117); UISegmentedControl.AppearanceWhenContainedIn(typeof(UINavigationBar)).TintColor = UIColor.White; // Composer Input Accessory Buttons UIButton.AppearanceWhenContainedIn(typeof(UIScrollView)).TintColor = Theme.PrimaryNavigationBarColor; //UITableViewHeaderFooterView.Appearance.TintColor = UIColor.FromRGB(228, 228, 228); var headerFooterContainers = new [] { typeof(UITableViewHeaderFooterView) }; foreach (var navbarAppearance in headerFooterContainers) { UILabel.AppearanceWhenContainedIn(navbarAppearance).TextColor = UIColor.FromRGB(110, 110, 117); UILabel.AppearanceWhenContainedIn(navbarAppearance).Font = UIFont.SystemFontOfSize(14f); } MenuSectionView.DefaultBackgroundColor = Theme.PrimaryMenuNavigationBarColor; MenuSectionView.DefaultTextColor = Theme.MenuSectionTextColor; UIToolbar.Appearance.BarTintColor = UIColor.FromRGB(245, 245, 245); UIBarButtonItem.AppearanceWhenContainedIn(typeof(UISearchBar)).SetTitleTextAttributes(new UITextAttributes { TextColor = UIColor.White }, UIControlState.Normal); }
// public static readonly IDictionary<string, ThemeColors> Themes = new Dictionary<string, ThemeColors>(StringComparer.OrdinalIgnoreCase) // { // {"blue", new ThemeColors(UIColor.FromRGB(0x1D, 0x62, 0xF0), UIColor.FromRGB(0x1A, 0xD6, 0xFD))}, // {"red", new ThemeColors(UIColor.FromRGB(231, 76, 60), UIColor.FromRGB(192, 57, 43))}, // }; // public static void SetPrimary(string colorName) { colorName = colorName ?? string.Empty; var primaryColor = Default.Primary; var secondaryColor = Default.Secondary; var iconColor = Default.Icon; // if (Themes.ContainsKey(colorName)) // { // var a = Themes[colorName]; // primaryColor = a.Primary; // secondaryColor = a.Secondary; // } PrimaryNavigationBarColor = primaryColor; MainTitleColor = secondaryColor; PrimaryNavigationBarTextColor = UIColor.White; var navBarBackground = CreateBackgroundImage(primaryColor); var navBarContainers = new [] { typeof(ThemedNavigationController), typeof(MainNavigationController) }; foreach (var navbarAppearance in navBarContainers.Select(x => UINavigationBar.AppearanceWhenContainedIn(x))) { navbarAppearance.TintColor = UIColor.White; navbarAppearance.BarTintColor = primaryColor; navbarAppearance.BackgroundColor = primaryColor; navbarAppearance.SetTitleTextAttributes(new UITextAttributes { TextColor = UIColor.White, Font = UIFont.SystemFontOfSize(18f) }); navbarAppearance.SetBackgroundImage(navBarBackground, UIBarPosition.Any, UIBarMetrics.Default); navbarAppearance.BackIndicatorImage = Images.BackButton; navbarAppearance.BackIndicatorTransitionMaskImage = Images.BackButton; } UISwitch.Appearance.OnTintColor = secondaryColor; UIImageView.AppearanceWhenContainedIn(typeof(UITableViewCell), typeof(MainNavigationController)).TintColor = iconColor; LoadingIndicatorView.DefaultColor = primaryColor; EmptyListView.DefaultColor = primaryColor; }
public static void Setup() { var theme = new Theme(); CurrentTheme = theme; var defaultValues = IoC.Resolve <IDefaultValueService>(); bool largeFonts; if (!defaultValues.TryGet("large_fonts", out largeFonts)) { largeFonts = false; } Theme.CurrentTheme.FontSizeRatio = largeFonts ? 1.3f : 1.0f; UIGraphics.BeginImageContext(new System.Drawing.SizeF(1, 64f)); UIColor.FromRGB(50, 50, 50).SetFill(); UIGraphics.RectFill(new System.Drawing.RectangleF(0, 0, 1, 64)); var img = UIGraphics.GetImageFromCurrentImageContext(); UIGraphics.EndImageContext(); NameTimeStringElement.NameColor = Theme.CurrentTheme.MainTitleColor; //Element.FontSizeRatio = Theme.CurrentTheme.FontSizeRatio; UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.LightContent; var navBarContainers = new [] { typeof(MenuNavigationController), typeof(ThemedNavigationController), typeof(MainNavigationController) }; foreach (var navbarAppearance in navBarContainers.Select(x => UINavigationBar.AppearanceWhenContainedIn(x))) { navbarAppearance.TintColor = UIColor.White; navbarAppearance.BarTintColor = UIColor.FromRGB(50, 50, 50); navbarAppearance.BackgroundColor = UIColor.FromRGB(50, 50, 50); navbarAppearance.SetTitleTextAttributes(new UITextAttributes { TextColor = UIColor.White, Font = UIFont.SystemFontOfSize(18f) }); navbarAppearance.SetBackgroundImage(img, UIBarPosition.Any, UIBarMetrics.Default); //CodeFramework.iOS.Utils.Hud.BackgroundTint = UIColor.FromRGBA(228, 228, 228, 128); navbarAppearance.BackIndicatorImage = Images.BackButton; navbarAppearance.BackIndicatorTransitionMaskImage = Images.BackButton; } // UIBarButtonItem.Appearance.SetBackButtonTitlePositionAdjustment(new UIOffset(-1000, -64), UIBarMetrics.LandscapePhone); // UIBarButtonItem.Appearance.SetBackButtonTitlePositionAdjustment(new UIOffset(-1000, -64), UIBarMetrics.Default); // // UserVoice.UVStyleSheet.Instance.NavigationBarTintColor = UIColor.White; // UserVoice.UVStyleSheet.Instance.NavigationBarTextColor = UIColor.White; UISegmentedControl.Appearance.TintColor = UIColor.FromRGB(110, 110, 117); UISegmentedControl.AppearanceWhenContainedIn(typeof(UINavigationBar)).TintColor = UIColor.White; // Composer Input Accessory Buttons UIButton.AppearanceWhenContainedIn(typeof(UIScrollView)).TintColor = UIColor.FromRGB(50, 50, 50); UITableViewHeaderFooterView.Appearance.TintColor = UIColor.FromRGB(228, 228, 228); UILabel.AppearanceWhenContainedIn(typeof(UITableViewHeaderFooterView)).TextColor = UIColor.FromRGB(136, 136, 136); UILabel.AppearanceWhenContainedIn(typeof(UITableViewHeaderFooterView)).Font = UIFont.SystemFontOfSize(13f * Theme.CurrentTheme.FontSizeRatio); UIToolbar.Appearance.BarTintColor = UIColor.FromRGB(245, 245, 245); UIBarButtonItem.AppearanceWhenContainedIn(typeof(UISearchBar)).SetTitleTextAttributes(new UITextAttributes { TextColor = UIColor.White }, UIControlState.Normal); // CodeFramework.Elements.NewsFeedElement.LinkColor = theme.MainTitleColor; // CodeFramework.Elements.NewsFeedElement.TextColor = theme.MainTextColor; // CodeFramework.Elements.NewsFeedElement.NameColor = theme.MainTitleColor; }