<div class="meta" robots="noindex">

</div>

Class

# iOSButton

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2020r2. Please use `MobileButton</api/user_interface/mobile/mobilebutton>` as a replacement.

</div>

## Description

This is the standard Button control for iOS.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                               | Type                                     | Read-Only | Shared |
|----------------------------------------------------|------------------------------------------|-----------|--------|
| `AccessibilityHint<iosbutton.accessibilityhint>`   | `Text</api/deprecated/text>`             |           |        |
| `AccessibilityLabel<iosbutton.accessibilitylabel>` | `Text</api/deprecated/text>`             |           |        |
| `Caption<iosbutton.caption>`                       | `Text</api/deprecated/text>`             |           |        |
| `Enabled<iosbutton.enabled>`                       | `Boolean</api/data_types/boolean>`       |           |        |
| `Height<iosbutton.height>`                         | `Double</api/data_types/double>`         | ✓         |        |
| `Left<iosbutton.left>`                             | `Double</api/data_types/double>`         | ✓         |        |
| `Name<iosbutton.name>`                             | `Text</api/deprecated/text>`             | ✓         |        |
| `Parent<iosbutton.parent>`                         | `iOSControl</api/deprecated/ioscontrol>` | ✓         |        |
| `TextColor<iosbutton.textcolor>`                   | `Color</api/data_types/color>`           |           |        |
| `TextFont<iosbutton.textfont>`                     | `iOSFont</api/deprecated/iosfont>`       |           |        |
| `Top<iosbutton.top>`                               | `Double</api/data_types/double>`         | ✓         |        |
| `Visible<iosbutton.visible>`                       | `Boolean</api/data_types/boolean>`       |           |        |
| `Width<iosbutton.width>`                           | `Double</api/data_types/double>`         | ✓         |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                           | Parameters                                                         | Returns                                                   | Shared |
|------------------------------------------------|--------------------------------------------------------------------|-----------------------------------------------------------|--------|
| `AddConstraint<iosbutton.addconstraint>`       | constraint As `iOSLayoutConstraint</api/ios/ioslayoutconstraint>`  |                                                           |        |
| `AddControl<iosbutton.addcontrol>`             | child As `MobileControl</api/user_interface/mobile/mobilecontrol>` |                                                           |        |
| `Control<iosbutton.control>`                   | index As `Integer</api/data_types/integer>`                        | `MobileControl</api/user_interface/mobile/mobilecontrol>` |        |
| `ControlCount<iosbutton.controlcount>`         |                                                                    | `Integer</api/data_types/integer>`                        |        |
| `Handle<iosbutton.handle>`                     |                                                                    | `Ptr</api/data_types/additional_types/ptr>`               |        |
| `Invalidate<iosbutton.invalidate>`             |                                                                    |                                                           |        |
| `RemoveConstraint<iosbutton.removeconstraint>` | constraint As `iOSLayoutConstraint</api/ios/ioslayoutconstraint>`  |                                                           |        |
| `RemoveControl<iosbutton.removecontrol>`       | child As `MobileControl</api/user_interface/mobile/mobilecontrol>` |                                                           |        |
| `SetTintColor<iosbutton.settintcolor>`         | value As `Color</api/data_types/color>`                            |                                                           |        |

## Events

<div class="rst-class">

table-centered_column_4

</div>

| Name                       | Parameters | Returns |
|----------------------------|------------|---------|
| `Action<iosbutton.action>` |            |         |
| `Close<iosbutton.close>`   |            |         |
| `Open<iosbutton.open>`     |            |         |

## Property descriptions

<div id="iosbutton.accessibilityhint">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSButton.AccessibilityHint

**AccessibilityHint** As `Text</api/deprecated/text>`

The accessibility hint is a longer description that is read aloud when VoiceOver is enabled.

``` xojo
Me.AccessibilityHint = "Click to calculate the value and display the next view."
```

<div id="iosbutton.accessibilitylabel">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSButton.AccessibilityLabel

**AccessibilityLabel** As `Text</api/deprecated/text>`

The accessibility label of of a control is a short name that is read aloud when VoiceOver is enabled.

``` xojo
Me.AccessibilityLabel = "Calculate the value."
```

<div id="iosbutton.caption">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSButton.Caption

**Caption** As `Text</api/deprecated/text>`

Gets or sets the caption for the Button.

Change the caption:

``` xojo
Me.Caption = "Save"
```

<div id="iosbutton.enabled">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSButton.Enabled

**Enabled** As `Boolean</api/data_types/boolean>`

Indicates whether the control is enabled or disabled.

Disable the button:

``` xojo
Button1.Enabled = False
```

<div id="iosbutton.height">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSButton.Height

**Height** As `Double</api/data_types/double>`

The height of the control.

This property is read-only.

<div id="iosbutton.left">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSButton.Left

**Left** As `Double</api/data_types/double>`

The left position of the control.

This property is read-only.

<div id="iosbutton.name">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSButton.Name

**Name** As `Text</api/deprecated/text>`

The name of the control. This can only be set in the Inspector. Use the name to refer to the control.

This property is read-only.

<div id="iosbutton.parent">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSButton.Parent

**Parent** As `iOSControl</api/deprecated/ioscontrol>`

Indicates the control's parent object, if it has one. If there is no parent, this is Nil.

This property is read-only.

<div id="iosbutton.textcolor">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSButton.TextColor

**TextColor** As `Color</api/data_types/color>`

The color to display the Caption text.

Change the Caption text color to red:

``` xojo
Button1.TextColor = Color.Red
```

<div id="iosbutton.textfont">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSButton.TextFont

**TextFont** As `iOSFont</api/deprecated/iosfont>`

The font use for displaying the Caption.

Change the button font and text size:

``` xojo
Button1.TextFont = iOSFont.ItalicSystemFont
Label1.TextFont = iOSFont.SystemFont(32)
```

<div id="iosbutton.top">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSButton.Top

**Top** As `Double</api/data_types/double>`

The top position of the control.

This property is read-only.

<div id="iosbutton.visible">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSButton.Visible

**Visible** As `Boolean</api/data_types/boolean>`

Indicates whether the control is visible.

Make a button invisible:

``` xojo
Button1.Visible = False
```

<div id="iosbutton.width">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSButton.Width

**Width** As `Double</api/data_types/double>`

The width of the control.

This property is read-only.

## Method descriptions

<div id="iosbutton.addconstraint">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSButton.AddConstraint

**AddConstraint**(constraint As `iOSLayoutConstraint</api/ios/ioslayoutconstraint>`)

Adds a constraint to the control. This constraint is used by child controls that have been added to this control.

<div id="iosbutton.addcontrol">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSButton.AddControl

**AddControl**(child As `MobileControl</api/user_interface/mobile/mobilecontrol>`)

Adds a child control to the control.

<div id="iosbutton.control">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSButton.Control

**Control**(index As `Integer</api/data_types/integer>`) As `MobileControl</api/user_interface/mobile/mobilecontrol>`

Gets the child control at the specified index.

<div id="iosbutton.controlcount">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSButton.ControlCount

**ControlCount** As `Integer</api/data_types/integer>`

The number of child controls in the control.

<div id="iosbutton.handle">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSButton.Handle

**Handle** As `Ptr</api/data_types/additional_types/ptr>`

The handle is used to get a reference to the control for interfacing directly with the iOS API.

<div id="iosbutton.invalidate">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSButton.Invalidate

**Invalidate**

Marks the control so that it will be redrawn during the next event loop.

Call Invalidate to force a Canvas to redraw itself:

``` xojo
Canvas1.Invalidate
```

<div id="iosbutton.removeconstraint">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSButton.RemoveConstraint

**RemoveConstraint**(constraint As `iOSLayoutConstraint</api/ios/ioslayoutconstraint>`)

Removes a constraint from the control.

<div id="iosbutton.removecontrol">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSButton.RemoveControl

**RemoveControl**(child As `MobileControl</api/user_interface/mobile/mobilecontrol>`)

Removes the control from the control.

<div id="iosbutton.settintcolor">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSButton.SetTintColor

**SetTintColor**(value As `Color</api/data_types/color>`)

Changes a control's tint color. This varies by control and for some controls may not do anything. For example, with an `MobileTextField</api/user_interface/mobile/mobiletextfield>` this changes the cursor color.

## Event descriptions

<div id="iosbutton.action">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSButton.Action

**Action**

The Action event handler is called when the button is pressed, tapped, clicked, etc.

Change Label Text when a Button is pressed:

``` xojo
Label1.Text = "You pressed the button."
```

<div id="iosbutton.close">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSButton.Close

**Close**

Called when the control is removed from its container, such as a view.

<div id="iosbutton.open">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSButton.Open

**Open**

Called after the control is created. This is where you typically put initialization code.

Set label text in Open event:

``` xojo
Me.Text = "Hello"
```

## Compatibility

iOS projects on the iOS operating system.

## See also

`MobileControl</api/user_interface/mobile/mobilecontrol>` parent class; `Font</api/graphics/font>` class, `MobileSegmentedButton</api/user_interface/mobile/mobilesegmentedbutton>` control
