Class

iOSUserControl


Warning

This item was deprecated in version 2020r2. Please use IOSMobileUserControl as a replacement.

Description

Used to embed UIViews created via declares into the Xojo control hierarchy.

Events

Name

Parameters

Returns

AppearanceChanged

dark As Boolean

Close

CreateView

Open

Property descriptions


iOSUserControl.AccessibilityHint

AccessibilityHint As Text

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

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

iOSUserControl.AccessibilityLabel

AccessibilityLabel As Text

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

Me.AccessibilityLabel = "Calculate the value."

iOSUserControl.Height

Height As Double

The height of the control.

This property is read-only.


iOSUserControl.Left

Left As Double

The left position of the control.

This property is read-only.


iOSUserControl.Name

Name As 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.


iOSUserControl.Parent

Parent As iOSControl

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

This property is read-only.


iOSUserControl.Top

Top As Double

The top position of the control.

This property is read-only.


iOSUserControl.Visible

Visible As Boolean

Indicates whether the control is visible.

Make a button invisible:

Button1.Visible = False

iOSUserControl.Width

Width As Double

The width of the control.

This property is read-only.

Method descriptions


iOSUserControl.AddConstraint

AddConstraint(constraint As iOSLayoutConstraint)

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


iOSUserControl.AddControl

AddControl(child As MobileControl)

Adds a child control to the control.


iOSUserControl.Control

Control(index As Integer) As MobileControl

Gets the child control at the specified index.


iOSUserControl.ControlCount

ControlCount As Integer

The number of child controls in the control.


iOSUserControl.Handle

Handle As Ptr

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


iOSUserControl.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:

Canvas1.Invalidate

iOSUserControl.RemoveConstraint

RemoveConstraint(constraint As iOSLayoutConstraint)

Removes a constraint from the control.


iOSUserControl.RemoveControl

RemoveControl(child As MobileControl)

Removes the control from the control.


iOSUserControl.SetTintColor

SetTintColor(value As Color)

Changes a control's tint color. This varies by control and for some controls may not do anything. For example, with an MobileTextField this changes the cursor color.

Event descriptions


iOSUserControl.AppearanceChanged

AppearanceChanged(dark As Boolean)

Called when a user switches between Light and Dark mode.

Use this event to update any graphics or other UI as needed.


iOSUserControl.Close

Close

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


iOSUserControl.CreateView

CreateView

Use this event to create the UIView to use for the control. Return the pointer to the UIView.


iOSUserControl.Open

Open

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

Set label text in Open event:

Me.Text = "Hello"

Notes

Each iOSControl has an underlying UIView. The iOSUserControl class lets you hand the framework explicitly what you want it to use for the UIView.

In the CreateView event, you should create and configure whatever UIView you want. If the UIView's initializer requires a frame rectangle, pass in anything arbitrary (it will be placed correctly via auto layout). The UIView should be returned autoreleased and not just the result of alloc+init.

You cannot place an iOSUserControl (from the Library) directly on a layout. Instead you must subclass it, add code to the CreateView event handler and then drag the subclass onto the layout.

Compatibility

iOS projects on the iOS operating system.

See also

MobileControl parent class; Declare