iOS Guides | Samples

MonoTouch.UIKit.UIStringAttributes Class

Strongly helper to define UIKit attributes for use with NSAttributedString.

See Also: UIStringAttributes


[MonoTouch.ObjCRuntime.Introduced(MonoTouch.ObjCRuntime.PlatformName.iOS, 6, 0, MonoTouch.ObjCRuntime.PlatformArchitecture.None, null)]
public class UIStringAttributes : DictionaryContainer


You use this class to create attributes that can be used with both NSAttributedString and NSMutableAttributedString. Since this class is strongly typed, you will get code completion as well as avoid common mistakes when using attributed strings with UIKit.

C# Example

// Using NSAttributedString with UIKit
var myText = new NSAttributedString ("Hello, world",
       new UIStringAttributes () {
              ForegroundColor =  UIColor.Red,
	      KerningAdjustment = 3
label.AttributedText = myText;


Namespace: MonoTouch.UIKit
Assembly: monotouch (in monotouch.dll)
Assembly Versions:

The members of MonoTouch.UIKit.UIStringAttributes are listed below.

See Also: DictionaryContainer

Public Constructors

Default constructor
Creates a UIStringAttributes from UIKit NSAttributedString attributes stored in a dictionary.

Public Properties

BackgroundColorUIColor. Background Color for the text.
BaselineOffsetNullable<float>. The distance from the bottom of the bounding box of the glyphs of the string to their baseline.
ExpansionNullable<float>. The log of the expansion factor to be applied to glyphs.
FontUIFont. Font to use for the text.
ForegroundColorUIColor. Foreground Color for the text
KerningAdjustmentNullable<float>. Kerning value used for the text
LigatureNullable<MonoTouch.Foundation.NSLigatureType>. The style of ligatures to use.
LinkNSUrl. The destination URL of a hyperlink.
ObliquenessNullable<float>. The amount of skew to apply to glyphs.
ParagraphStyleNSParagraphStyle. Used to specify a custom paragraph style.
ShadowNSShadow. Shadow to use for the text.
StrikethroughColorUIColor. The color to be used for the strikethrough stroke.
StrikethroughStyleNullable<MonoTouch.Foundation.NSUnderlineStyle>. Strikethrough style.
StrokeColorUIColor. Stroke Color.
StrokeWidthNullable<float>. The stroke width for drawing the text
TextAttachmentNSTextAttachment. The NSTextAttachment, if any.
TextEffectNSTextEffect. The NSTextEffect applied to the string.
UnderlineColorUIColor. The color of the underline stroke.
UnderlineStyleNullable<MonoTouch.Foundation.NSUnderlineStyle>. Underline style for the text.
WeakTextEffectNSString. A reference to the text effect that does not prevent garbage collection of the underlying resource.
WritingDirectionIntNSNumber[]. An array indicating the writing-direction overrides.