iOS Guides | Samples

MonoTouch.UIKit.UIButton Class

Button control.

See Also: UIButton

Syntax

[MonoTouch.Foundation.Register("UIButton", true)]
public class UIButton : UIControl, IUIAccessibilityContentSizeCategoryImageAdjusting, IUISpringLoadedInteractionSupporting, IDisposable

Remarks

A UIControl that receives touch events. UIButtons are generally visible and often have a text UIButton.Title.

Related content

Requirements

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

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

See Also: UIControl

Public Constructors

Default constructor that initializes a new instance of this class with no parameters.
A constructor that initializes the object from the data stored in the unarchiver object.
Constructor to call on derived classes to skip initialization and merely allocate the object.
Preferred constructor for UIButtons, but can not be used when subclassing.
Initializes the UIButton with the specified frame.
A constructor used when creating managed representations of unmanaged objects; Called by the runtime.

Public Properties

AdjustsImageWhenDisabledBoolean. Whether the image changes when this UIButton is disabled.
AdjustsImageWhenHighlightedBoolean. Whether the image changes when this UIButton is highlighted.
[read-only]
static
AppearanceUIButton+UIButtonAppearance. Strongly-typed property that returns the UIAppearance class for this class.
[read-only]
ButtonTypeUIButtonType. The UIButtonType of this UIButton.
[read-only]
override
ClassHandleIntPtr. The handle for this class.
ContentEdgeInsetsUIEdgeInsets. The insets or outsets for the RectangleF surrounding this UIButton's contents.
[read-only]
CurrentAttributedTitleNSAttributedString. The title currently being displayed by this UIButton, with attributes. Read-only.
[read-only]
CurrentBackgroundImageUIImage. The UIImage that is displayed in the background of this UIButton. Read-only.
[read-only]
CurrentImageUIImage. The UIImage that is displayed on this UIButton. Read-only.
[read-only]
CurrentTitleString. The title currently being displayed by this UIButton. Read-only.
[read-only]
CurrentTitleColorUIColor. The color used to display this UIButton's CurrentTitle. Read-only.
[read-only]
CurrentTitleShadowColorUIColor. The color being used for this UIButton's title's shadow. Read-only.
FontUIFont. The font used for the text of the button.
ImageEdgeInsetsUIEdgeInsets. The insets or outsets for the RectangleF around this UIButton's CurrentImage.
[read-only]
ImageViewUIImageView. This UIButton's UIImageView. Read-ony.
LineBreakModeUILineBreakMode. The line-break mode of the button.
ReverseTitleShadowWhenHighlightedBoolean. Whether the title shadow should change when this UIButton is highlighted.
ShowsTouchWhenHighlightedBoolean. Whether this UIButton should glow when tapped.
TitleEdgeInsetsUIEdgeInsets. The insets or outsets for the RectangleF around this UIButton's CurrentTitle.
[read-only]
TitleLabelUILabel. The UIView that displays the value of this UIButton's CurrentTitle. Read-only.
TitleShadowOffsetSizeF. The offset used for creating the title's shadow.

Public Methods

static
AppearanceWhenContainedIn(params Type[]) : UIButton+UIButtonAppearance
Returns a strongly typed UIAppearance for instances of this class when the view is hosted in the specified hierarchy.
BackgroundImageForState(UIControlState) : UIImage
The background image used for the specified state.
BackgroundRectForBounds(RectangleF) : RectangleF
The RectangleF in which this UIButton draws its background.
ContentRectForBounds(RectangleF) : RectangleF
The RectangleF in which this UIButton draws its entire content.
static
FromType(UIButtonType) : UIButton
Creates a new UIButton of the specified type.
static
GetAppearance(UITraitCollection) : UIButton+UIButtonAppearance
Returns an appearance proxy for the specified traits.
static
GetAppearance(UITraitCollection, params Type[]) : UIButton+UIButtonAppearance
Returns an appearance proxy for the specified traits when found in the containers containment hierarchy.
static
GetAppearance<T>() : UIButton+UIButtonAppearance
Obtains the appearance proxy UIButtonAppearance for the subclass of UIButton.
static
GetAppearance<T>(UITraitCollection) : UIButton+UIButtonAppearance
Obtains the appearance proxy UIButtonAppearance for the subclass of UIButton.
static
GetAppearance<T>(UITraitCollection, params Type[]) : UIButton+UIButtonAppearance
Obtains the appearance proxy UIButtonAppearance for the subclass of UIButton that has the specified trait collection when the view is hosted in the specified hierarchy.
GetAttributedTitle(UIControlState) : NSAttributedString
The title, with style attributes, for the specified state.
ImageForState(UIControlState) : UIImage
The UIImage used for the specified state.
ImageRectForContentRect(RectangleF) : RectangleF
The RectangleF in which this UIButton draws its CurrentImage.
SetAttributedTitle(NSAttributedString, UIControlState)
Sets the button title with an attributed string for a particular control state.
SetBackgroundImage(UIImage, UIControlState)
Sets the background image for the specified button state.
SetImage(UIImage, UIControlState)
Sets the image for the specified button state.
SetTitle(String, UIControlState)
Sets the title for the specified button state.
SetTitleColor(UIColor, UIControlState)
Sets the title color for the specified button state.
SetTitleShadowColor(UIColor, UIControlState)
Sets the title shadow color for the specified button state.
Title(UIControlState) : String
The title for the specified button state.
TitleColor(UIControlState) : UIColor
The title color for the specified button state.
TitleRectForContentRect(RectangleF) : RectangleF
The RectangleF in which this UIButton draws its title.
TitleShadowColor(UIControlState) : UIColor
The shadow color of the title for the specified button state.