User Interface: Sizes of iPhone UI Elements

iPhone Development 101: User Interface: 
Sizes of iPhone UI Elements

How to detect the current device size (and how to tell if it's an iPhone 5)

Element iPhone 4S (and earlier)iPhone 5
Window (including status bar) 320 x 480 pts 320 x 568 pts
Status Bar
(How to hide the status bar)
20 pts 20 pts
View inside window 
(visible status bar)
320 x 460 pts 320 x 548 pts
Navigation Bar 44 pts 44 pts
Nav Bar/Toolbar Icon white icon - up to 20 x 20 pts (transparent PNG)
Tab Bar 49 pts 49 pts
Tab Bar Icon up to 30 x 30 pts (transparent PNGs)
Text Field 31 pts 31 pts
Height of a view inside 
a navigation bar
416 pts 504 pts
Height of a view inside 
a tab bar
411 pts 499 pts
Height of a view inside 
a navbar and a tab bar
367 pts 455 pts
Portrait Keyboard (English) 320 x 216 pts 320 x 216 pts
Landscape Keyboard (English) 480 x 162 pts 568 x 162 pts
Launch Image
(Launch Image Sizes
for iPhone & iPad
)
640 x 960 pixels 640 x 1136 pixels
This page is available as an interactive version in the idev101 app!

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:

Standard Size: High Resolution:

button.png
60 x 20

button@2x.png
120 x 40

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:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值