【筆記】Sizes of iPhone UI Elements,iphone 解析度&元素大小。 - ...

【筆記】Sizes of iPhone UI Elements,iphone 解析度&元素大小。


Points vs. Pixels

Apple introduced retina displays starting with the iPhone 4. These have twice as many screen pixels as previous iPhones. You don't have to modify your code to support high-res displays; the iOS coordinate system uses points rather than pixels, so the dimensions and position in points of all UI elements remains the same across all devices.


iOS supports high resolution displays via the scale property on UIScreen, UIView, UIImage, and CALayer classes. If the object is displaying high-resolution content, its scale property is set to 2.0. Otherwise it defaults to 1.0.



Retina Graphics


To support high-resolution graphics on devices with retina displays, create two versions of the image: a standard size image, and a double-sized image with "@2x" added to the name:


To refer to an image in your code (or in Interface Builder), use the filename of the standard sized image. iOS will automatically detect and use the @2x version if the device supports it:  


imageView.image = [UIImage imageNamed:@"button.png"];




資訊來源: 


沒有留言:

張貼留言

歡迎推薦文章或分享、留言。