UITextAttributes Class

Definition

Type used to describe the text attributes to set on some user interface elements.

public class UITextAttributes
type UITextAttributes = class
Inheritance
UITextAttributes

Remarks

Typically, developers create an instance of this class and fill out the various properties to configure the desired text attributes.

For example, the following code can be used to change the style of the UINavigationBar:

var attrs = new UITextAttributes () {
	Font = UIFont.FromName ("Chalkduster", 20),
	TextColor = UIColor.Red,
	TextShadowColor = UIColor.Black,
	TextShadowOffset = new UIOffset (6, 6)
};
myNavController.NavigationBar.SetTitleTextAttributes (attrs);

You can use code completion inside the constructor for UITextAttributes without having to remember the properties that you want to set.

You can set the text attributes on the following items: UIBarItem, UINavigationBar, UISearchBar, and UISegmentedControl.

Constructors

Name Description
UITextAttributes()

Initializes a new instance of the UITextAttributes class.

Fields

Name Description
Font

The font to use to render the text.

TextColor

The color to use for the text.

TextShadowColor

The color to use for the shadow of the text when TextShadowOffset is set.

TextShadowOffset

The offset describing the distance between the text and its shadow.

Applies to