UIButton.SetAttributedTitle(NSAttributedString, UIControlState) UIButton.SetAttributedTitle(NSAttributedString, UIControlState) Method

Definition

Sets the button title with an attributed string for a particular control state.

[Foundation.Export("setAttributedTitle:forState:")]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 6, 0, ObjCRuntime.PlatformArchitecture.All, null)]
public virtual void SetAttributedTitle (Foundation.NSAttributedString title, UIKit.UIControlState state);
abstract member SetAttributedTitle : Foundation.NSAttributedString * UIKit.UIControlState -> unit
override this.SetAttributedTitle : Foundation.NSAttributedString * UIKit.UIControlState -> unit

Parameters

title
NSAttributedString NSAttributedString

The attributed string to set.

state
UIControlState UIControlState

The scope for the text.

Remarks


var title = new NSAttributedString (
    "Hello, World",
    font: UIFont.FromName ("HoeflerText-Regular", 24.0f),
    foregroundColor: UIColor.Red,
    strokeWidth: 4
);
myButton.SetAttributedTitle (title, UIControlState.Normal);

Applies to