Where can I get system size of UI elements in iOS?
For example,
- UIButton corner radius,
- UIWindow size (I know it's 320pt, but is there a constant for it?),
- System font size,
- Navigation bar height,
- Tab bar height,
- Status bar height, etc.
D开发者_开发知识库o they have predefined constants or similar?
UIButton corner radius
I don't think there's an API for that.
UIWindow size (I know it's 320pt, but is there a constant for it?)
You could get this via [[UIScreen mainScreen] bounds]
.
System font size
UIFont
has class methods for getting standard font sizes: labelFontSize
, buttonFontSize
, smallSystemFontSize
and systemFontSize
are available.
Navigation bar height, Tab bar height,
The UIView
instance method sizeThatFits:
could be used to get the default sizes for those.
Status bar height
You can get this implicitly by subtracting the height of [[UIScreen mainScreen] bounds]
from [[UIScreen mainScreen] applicationFrame]
.
You can find the common UIElement sizes here: http://www.idev101.com/code/User_Interface/sizes.html
精彩评论