Class

iOSImageView


Warning

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

Description

Displays an image.

Events

Name

Parameters

Returns

Close

Open

Enumerations

iOSImageView.ContentModes

ContentModes

ScaleToFill, ScaleAspectFit, ScaleAspectFill, Center, Top, Bottom, Left, Right, TopLeft, TopRight, BottomLeft, BottomRight

Enum

Description

ScaleToFill

The image's aspect ratio is ignored and the image is stretched to fit within the bounds of the frame.

ScaleAspectFit

Scales the image until it fits entirely, maintaining aspect.

ScaleAspectFill

Scales the image until it fills the ImageView entirely, maintaining aspect.

Center

The image is centered within the frame.

Top

The image is positioned with its top at the top of the frame.

Bottom

The image is positioned with its bottom at the bottom of the frame.

Left

The image is positioned with its left at the left of the frame.

Right

The image is positioned with its right at the right of the frame.

TopLeft

The image is positioned with its top left at the top left of the frame.

TopRight

The image is positioned with its top right at the top right of the frame.

BottomLeft

The image is positioned with its bottom left at the bottom left of the frame.

BottomRight

The image is positioned with its bottom right at the bottom right of the frame.

Property descriptions


iOSImageView.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."

iOSImageView.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."

iOSImageView.ContentMode

ContentMode As ContentModes

Specifies the way the picture gets displayed using the ContentModes enumeration.

Center the image within the frame:

Me.ContentMode = iOSImageView.ContentModes.Center

iOSImageView.Height

Height As Double

The height of the control.

This property is read-only.


iOSImageView.Image

Image As iOSImage

The image to display.

Display an image in the project:

Me.Image = MyCompanyLogo

iOSImageView.Left

Left As Double

The left position of the control.

This property is read-only.


iOSImageView.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.


iOSImageView.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.


iOSImageView.Top

Top As Double

The top position of the control.

This property is read-only.


iOSImageView.Visible

Visible As Boolean

Indicates whether the control is visible.

Make a button invisible:

Button1.Visible = False

iOSImageView.Width

Width As Double

The width of the control.

This property is read-only.

Method descriptions


iOSImageView.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.


iOSImageView.AddControl

AddControl(child As MobileControl)

Adds a child control to the control.


iOSImageView.Control

Control(index As Integer) As MobileControl

Gets the child control at the specified index.


iOSImageView.ControlCount

ControlCount As Integer

The number of child controls in the control.


iOSImageView.Handle

Handle As Ptr

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


iOSImageView.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

iOSImageView.RemoveConstraint

RemoveConstraint(constraint As iOSLayoutConstraint)

Removes a constraint from the control.


iOSImageView.RemoveControl

RemoveControl(child As MobileControl)

Removes the control from the control.


iOSImageView.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


iOSImageView.Close

Close

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


iOSImageView.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"

Sample code

This code adds an iOSImageView instance programmatically to the default main project view. The item "AppleImage" is an Picture instance added to the Project Browser from the Library.

This code is executed from the Open Event Handler in the default "View1" iOSView.

Var iv As New iOSImageView

iv.ContentMode = iOSImageView.ContentModes.ScaleAspectFit ' Set how the image will be displayed in the iOSImageView view
iv.Image = AppleImage

me.AddControl iv

' Applying constraints to the superview (View1), so they set the position and size of the iOSImageView when displayed
' (size and position = centered with a marging of 50 points from the parent view edges)

Var RightC As New iOSLayoutConstraint(iv,iOSLayoutConstraint.AttributeTypes.Right, iOSLayoutConstraint.RelationTypes.Equal, _
self, iOSLayoutConstraint.AttributeTypes.Right,1.0,-50)

Var LeftC As New iOSLayoutConstraint(iv,iOSLayoutConstraint.AttributeTypes.left, iOSLayoutConstraint.RelationTypes.Equal, _
self, iOSLayoutConstraint.AttributeTypes.Left,1.0,50)

Var TopC As New iOSLayoutConstraint(iv,iOSLayoutConstraint.AttributeTypes.Top, iOSLayoutConstraint.RelationTypes.Equal, _
self, iOSLayoutConstraint.AttributeTypes.Top,1.0,50)

Var BottomC As New iOSLayoutConstraint(iv,iOSLayoutConstraint.AttributeTypes.Bottom, iOSLayoutConstraint.RelationTypes.Equal, _
self, iOSLayoutConstraint.AttributeTypes.bottom,1.0,-50)

me.AddConstraint RightC
me.AddConstraint LeftC
me.AddConstraint TopC
me.AddConstraint BottomC

Compatibility

iOS projects on the iOS operating system.

See also

MobileControl parent class; Picture class