iOSImageView

From Xojo Documentation

Revision as of 19:37, 29 September 2020 by Gperlman (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Class (inherits from iOSControl)

Displays an image.

Events
Close Open
Properties
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
Methods
AddConstraint ControlCount RemoveConstraint
AddControl Handle RemoveControl
Control Invalidate SetTintColor
Enumerations
ContentModes

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