/// <summary> /// Adds an existing text container (UILabel, UITextView, UITextField) to the StyleManager and styles it /// </summary> /// <param name="target">Target text container</param> /// <param name="styleID">The CSS selector name for the style</param> /// <param name="text">Text to display. Plain or with html tags</param> /// <param name="customTags">A list of custom <c>CSSTagStyle</c> instances that set the styling for the html</param> /// <param name="useExistingStyles">Existing CSS styles willl be used If set to <c>true</c></param> /// <param name="encoding">String encoding type</param> public void Add(object target, string styleID, string text = "", List <CssTagStyle> customTags = null, bool useExistingStyles = true) { // Set the base style for the field TextStyle.SetBaseStyle(styleID, ref customTags); var viewStyle = new ViewStyle((UIView)target, text, true) { StyleID = styleID, CustomTags = customTags }; _views.Add(target, viewStyle); viewStyle.UpdateText(); viewStyle.UpdateDisplay(); }
/// <summary> /// Creates and styles a new text container (UIlabel, UITextView, UITextField) /// </summary> /// <param name="styleID">The CSS selector name for the style</param> /// <param name="text">Text to display. Plain or with html tags</param> /// <param name="customTags">A list of custom <c>CSSTagStyle</c> instances that set the styling for the html</param> /// <param name="useExistingStyles">Existing CSS styles willl be used If set to <c>true</c></param> /// <param name="encoding">String encoding type</param> /// <typeparam name="T">Text container type (UIlabel, UITextView, UITextField)</typeparam> public T Create <T> (string styleID, string text = "", List <CssTagStyle> customTags = null, bool useExistingStyles = true) { var target = TextStyle.Create <T> (styleID, text, customTags, useExistingStyles); TextStyle.SetBaseStyle(styleID, ref customTags); var reference = new ViewStyle(target as UIView, text, true) { StyleID = styleID, CustomTags = customTags }; _views.Add(target, reference); return(target); }