Hi
If I have an image larger than the image view size, haw to instruct the image view to deal with it in different ways, such is to show part of it, or resize it and stretch it, or resize and keeong the aspect ratio ?
--
Kindest Regards
Set the imageView.contentMode to what you need.
There are a lot of options to select:
case scaleToFill
The option to scale the content to fit the size of itself by changing the aspect ratio of the content if necessary.
case scaleAspectFit
The option to scale the content to fit the size of the view by maintaining the aspect ratio. Any remaining area of the view’s bounds is transparent.
case scaleAspectFill
The option to scale the content to fill the size of the view. Some portion of the content may be clipped to fill the view’s bounds.
case redraw
The option to redisplay the view when the bounds change by invoking the
setNeedsDisplay()
method.case center
The option to center the content in the view’s bounds, keeping the proportions the same.
case top
The option to center the content aligned at the top in the view’s bounds.
case bottom
The option to center the content aligned at the bottom in the view’s bounds.
case left
The option to align the content on the left of the view.
case right
The option to align the content on the right of the view.
case topLeft
The option to align the content in the top-left corner of the view.
case topRight
The option to align the content in the top-right corner of the view.
case bottomLeft
The option to align the content in the bottom-left corner of the view.
case bottomRight
The option to align the content in the bottom-right corner of the view.