Using PDF Files for Icon Images in Xcode 7.2

I am trying to use PDF files as icons in the application I'm working on. The problem I am facing is that I get inconsistent hue colors.

If I installed the button image from the interface designer, the icon image will appear black at runtime . Everytime. No matter what I try to install from the interface constructor.

I tried to set the button image using code and instead of showing black, white :

let myGraphicFile = UIImage(named: "myPDFImage")
let myButtonImage = myGraphicFile?.imageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate)
myButton.setImage(myButtonImage, forState: .Normal)

From the code, no matter what I try to set the hue to, it is always white from the code.

I found this post related to Xcode 6.x, but I think it can be dated since I can partially do this, but I canโ€™t set the hue.

Use PDF in Xcode for AppIcon (.appiconset Collection)

I create icons in Inkscape, save as PDF 1.5. I am adding the file to Images.xcassets. In the attribute inspector, Images.xcassets'I set:

Devices for universal

Scale factor into a single vector.

Summary: I can make it display and scale normally, but it is either black from the interface designer or white from the code. I suspect I am missing something new: how to save a file from Inkscape.

Thanks for reading. If you have any suggestions, I welcome them.

+4
1

, Inkscape. PDF iOS, xcAssets :

1) PDF xcAssets

2) ( Universal )

3) PDF 1x, 2x 3x, Universal .

4) Single Vector.

5) .

enter image description here

, , . , , , ... xcAssets, . iOS . , , , .

- - , .

, . fooobar.com/questions/42258/...

+5

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


All Articles