Resizable Image Clarifications

Hello Everyone,

While watching the “Styling with buttons and sliders” lecture I felt that something was missing in Ray’s explanation about the resizable images, and if there is anyone like me who is bothered by it, It would only make me happy :wink:

To the Explanation →

To make a resizable image you’ll obviously have to first-of-all load it and store it inside a variable, then the UIImage object has a method named: “resizableImage(withCapInsets: UIEdgeInsets )” which takes cap inset values of the UIEdgeInset type.

Now capInsets are called end caps which when creating you have to specify which areas of the image are fine to be stretched (a.k.a between the end caps) and which areas should be preserved (end caps themselves)

That is my explanation, but obviously apple explain much better so you can read the documentation here if you’d like : Apple Developer Documentation

Thanks for reading,

Shay

2 Likes