편집

다음을 통해 공유


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

The attributed string to set.

state
UIControlState

The scope for the text.

Attributes

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