iOS Guides | Samples

MonoTouch.UIKit.UIButton Constructor

Preferred constructor for UIButtons, but can not be used when subclassing.

Syntax

public UIButton (UIButtonType type)

Parameters

type
Button type to create.

Remarks

This constructor should only be used in user code when you plan on using the C# syntax to initialize properties after the object has been created, like this:

C# Example

var b = new UIButton (UIButtonType.Custom) {
    AdjustsImageWhenHighlighted = true,
    ContentEdgeInsets = myInsets;
};

This constructor can not be used when subclassing as it is not a real constructor, but instead a convenience constructor that calls the static UIButton.FromType method and then wraps the result into this object. So you should avoid subclassing UIButton and then calling into this constructor from your subclass constructor.

Requirements

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