Application developers must use this property if they desire the use of multiple text styles in the UIKit.UITextView. The following example uses Foundation.NSMutableAttributableString.AddAttribute to modify the color and font in a various ranges, as shown in the image.
C# Example
//UITextView default var atts = new UIStringAttributes(); atts.ForegroundColor = UIColor.Blue; var txt = "Text Kit.\n Lorem ipsum different font dolor sit amet, consectetur adipiscing elit."; var attributedString = new NSMutableAttributedString(txt,atts); //Multiple type styles. attributedString.BeginEditing(); attributedString.AddAttribute(UIStringAttributeKey.ForegroundColor, UIColor.Red, new NSRange(0, 10)); attributedString.AddAttribute(UIStringAttributeKey.Font, UIFont.PreferredFontForTextStyle(UIFontTextStyle.Headline), new NSRange(0, 10)); attributedString.AddAttribute(UIStringAttributeKey.Font, UIFont.FromName("Georgia", 20), new NSRange(23, 14)); attributedString.EndEditing(); TextView.AttributedText = attributedString;