【筆記】Sizes of iPhone UI Elements,iphone 解析度&元素大小。 - Mai LaLa's Little Diary. 麥菈菈日日記✎

【筆記】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"];




資訊來源: 


沒有留言:

張貼留言

✽歡迎推薦文章或分享,並留言給Mai LaLa~ 這些支持是我不斷分享的動力歐!ヽ(≧∀≦)ノ

❤ 沒有blogger帳號的話,可選擇【名稱 / 網址】,打上名稱與mail即可留言
❤ 如有未經許可或非法廣告、匿名者攻訐將會直接刪除留言
❤ 留言可使用 HTML 標記,如:粗體, 斜體, 描述文字... 等