2011年1月5日

[轉] iPhone Development 101: User Interface: Sizes of iPhone UI Elements

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


ElementSize (in pixels)
Window (including status bar)320 x 480px
Status Bar
(How to hide the status bar)
20 px
View inside window
(visible status bar)
320 x 460
Navigation Bar44 px
Nav Bar Image /
Toolbar Image
up to 20 x 20 px (transparent PNG)
Tab Bar49 px
Tab Bar Iconup to 30 x 30 px (transparent PNGs)
Text Field31 px
Height of a view inside
a navigation bar
416 px
Height of a view inside
a tab bar
411 px
Height of a view inside
a navbar and a tab bar
367 px
Portrait Keyboard height216 px
Landscape Keyboard height140 px

Viewing / Adjusting Sizes in Interface Builder

Sizes for specific UI elements (buttons, text fields, images, etc.) can be adjusted in the size panel of the Inspector window (↑⌘I):
iconshortcut
⌘3Size is the size and location (in X,Y coordinates) of the object on screen.
Size (and location) can also be adjusted programmatically:
[button setFrame:CGRectMake(x, y, width, height)];
The x, y position refers to the top left corner of the view being positioned.

Frame and Bounds

The frame is the outer container for the view - the position of the item within its enclosing superview. x is the distance left-right, where x = 0 is the left side. y is the distance up-down, where y = 0 is the top of the frame.
The bounds rectangle determines the origin and scale in the view's coordinate system within its frame rectangle. Setting this property changes the value of the frame property accordingly.
When you set the frame property, the size of the bounds property is set to match the size of the frame property. The center property is also adjusted to match the center point of the new frame.

Additional References

沒有留言: