Use PDF for assets in Xcode 7 - SpriteKit

Hello,

I wanted to use different images for each screen resolution (iPhone and iPad), and I found that I can use PDF files for images in assets, so I did it. Here is the configuration of my asset:

asset configuration

I will not use the correct path, or if I can make it easier. For example, I have a button located in the center of the screen (in this case, the code does not interest us):

let buttonWidth = self.size.width * 0.5
let buttonHeight = buttonWidth * 0.1

button = UIButton(type: UIButtonType.Custom) as UIButton
button.frame = CGRectMake(0, 0, buttonWidth, buttonHeight)
button.setBackgroundImage(UIImage(named: "buttonImageInitial"), forState: UIControlState.Normal)
self.view?.addSubview(button)

, self.size.width iPhone 4S (640), iPhone 4S: 640 * 0,5 = 320, : 320 * 0.1 = 32. , : : 320, : 32. Photoshop ( ), PDF. iPhone ( , Xcode , "320 x 32 " ). iPap , self.size.width iPhone 4S, iPad (1536), 768 * 76,8 .

: , Universal ?

Xcode: Xcode 7.0 beta 5

!

+4
2

Xcode 8, " " "" ( " " ) .

attribute inspector panel showing the attributes of the image set with the selected

+1

, , , .

PDF Xcode ( iOS), 1x , (PNG) (1x, 2x, 3x). , , - . Xcode 1x, 2x 3x, , PDF. PDF , , 160x32, Xcode : 160x32 (1x), 320x64 (2x) 480x96 (3x).

, Xcode PDF , , , .

0

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


All Articles