From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Class (inherits from iOSControl)

Displays an image.

Close Open
AccessibilityHint Image Top fa-lock-32.png
AccessibilityLabel Left fa-lock-32.png Visible
ContentMode Name fa-lock-32.png Width fa-lock-32.png
Height fa-lock-32.png Parent fa-lock-32.png
AddConstraint ControlCount RemoveConstraint
AddControl Handle RemoveControl
Control Invalidate SetTintColor

Example Code

This code adds an iOSImageView instance programmatically to the default main project view. The item "AppleImage" is an iOSImage 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

See Also

iOSImage class