What is the UIImageView Stretch Property. How can I use this property.?

enter image description here

I want to know how I can use this property for UIImageView.

+6
source share
2 answers

The tensile properties are pretty simple, as Karol Kozub stated in this article :

The fraction of the original image left without stretching on the left is specified by X

The fraction of the original image stretched along the x axis is determined by the width

The fraction of the original image left without stretching to right is 1 - X - Width

If we use 0 for the width, the stretched area will interpolate between the last pixel of the left side and the first pixel of the right side

Y axis works similarly

+3
source

This sets the contentStretch property for the views (this is a UIView property, not just a UIImageView property). However, this property is deprecated from iOS 6, so you should not use it.

Replacement, especially for images, resizableImageWithCapInsets . A common use for this is to create an image with left and right sides (or top and bottom), and with one pixel β€œmiddle” that is stretched in appearance. This is common for custom buttons, both because it is flexible for different widths and because it saves some space.

See "Defining a stretchable image" in UIImage docs for more information .

+1
source

All Articles