/// <summary> /// Applies a theme to the specified text view. /// </summary> /// <param name="field">A text view to apply the theme to.</param> /// <param name="theme">The theme to apply to the text view.</param> /// <param name="fontSize">The size of the font for the text field.</param> public static void ApplyTheme(this UITextView field, TextFieldTheme theme, int fontSize) { field.BackgroundColor = theme.BackgroundColor.ToUIColor(); field.TintColor = theme.CursorColor.ToUIColor(); field.Font = ViewThemeExtensions.GetFont(theme.FontName, fontSize); field.TextColor = theme.FontColor.ToUIColor(); }
/// <summary> /// Applies a theme to the specified text field. /// </summary> /// <param name="field">A text field to apply the theme to.</param> /// <param name="theme">The theme to apply to the text field.</param> /// <param name="fontSize">The size of the font for the text field.</param> public static void ApplyTheme(this UITextField field, TextFieldTheme theme, int fontSize) { field.BackgroundColor = theme.BackgroundColor.ToUIColor(); field.TintColor = theme.CursorColor.ToUIColor(); if (field.BorderStyle != UITextBorderStyle.None) { // apply the background color to the boarder to give the field a 'thicker' appearance field.Layer.BorderColor = theme.BackgroundColor.ToCGColor(); field.Layer.BorderWidth = Constants.TextFieldBorderWidth; } field.Font = ViewThemeExtensions.GetFont(theme.FontName, fontSize); field.TextColor = theme.FontColor.ToUIColor(); if (!string.IsNullOrWhiteSpace(field.Placeholder)) { field.AttributedPlaceholder = new NSAttributedString(field.Placeholder, null, theme.PlaceHolderColor.ToUIColor()); } }
/// <summary> /// Applies a theme to the specified text view. /// </summary> /// <param name="field">A text view to apply the theme to.</param> /// <param name="theme">The theme to apply to the text view.</param> public static void ApplyTheme(this UITextView field, TextFieldTheme theme) { field.ApplyTheme(theme, ViewFontSizes.LargeFontSize); }