5

someone can give an example to use Vector image (.pdf) on Xcode with option Render: "as template" in the image.xcasset? Can I programatically set color of the vector image? if yes how?

Thanks, Omar.

Omar Cafini
  • 51
  • 1
  • 4

1 Answers1

9

Yes, you can. When using "as template", the system ignores the image’s color information and creates an image stencil based on the alpha values in the image (parts of the image with an alpha value of less than 1.0 get treated as completely transparent). This stencil can then be recolored using tintColor to match the rest of your user interface.

See Apple documentation about template images in UIKitUICatalog.

Ludovic Landry
  • 11,606
  • 10
  • 48
  • 80