UIImage and resizableImageWithCapInsets Swift

I am new to Apple Swift. I read the article here

But I don’t know how to do it (or just don’t know how to use resizableImageWithCapInsets with Swift). Please help me use resizableImageWithCapInsets in Swift

+8
source share
1 answer

The general way in Xcode 6.1 is:

  • Create UIImage as a variable
  • Create Inserts
  • Create a new image based on the original image and inserts, and assign it to the original image

 var myImage = UIImage(named: "navbar.png")! let myInsets : UIEdgeInsets = UIEdgeInsetsMake(13, 37, 13, 37) myImage = myImage.resizableImageWithCapInsets(myInsets) 
+18
source

Source: https://habr.com/ru/post/976415/


All Articles