简体   繁体   English

iPhone界面尺寸

[英]iPhone Interface Sizes

Where can I get system size of UI elements in iOS? 在哪里可以获取iOS中UI元素的系统大小?

For example, 例如,

  • UIButton corner radius, UIButton角半径,
  • UIWindow size (I know it's 320pt, but is there a constant for it?), UIWindow的大小(我知道它是320pt,但是有一个常数吗?),
  • System font size, 系统字体大小,
  • Navigation bar height, 导航栏高度
  • Tab bar height, 标签栏高度,
  • Status bar height, etc. 状态栏高度等

Do they have predefined constants or similar? 它们是否具有预定义的常数或类似的常数?

UIButton corner radius UIButton角半径

I don't think there's an API for that. 我认为没有API。

UIWindow size (I know it's 320pt, but is there a constant for it?) UIWindow的大小(我知道它是320pt,但是有一个常数吗?)

You could get this via [[UIScreen mainScreen] bounds] . 您可以通过[[UIScreen mainScreen] bounds]

System font size 系统字体大小

UIFont has class methods for getting standard font sizes: labelFontSize , buttonFontSize , smallSystemFontSize and systemFontSize are available. UIFont有越来越标准字体大小类方法: labelFontSizebuttonFontSizesmallSystemFontSizesystemFontSize可用。

Navigation bar height, Tab bar height, 导航栏高度,标签栏高度,

The UIView instance method sizeThatFits: could be used to get the default sizes for those. UIView实例方法sizeThatFits:可用于获取这些对象的默认大小。

Status bar height 状态栏高度

You can get this implicitly by subtracting the height of [[UIScreen mainScreen] bounds] from [[UIScreen mainScreen] applicationFrame] . 您可以通过从[[UIScreen mainScreen] applicationFrame]减去[[UIScreen mainScreen] bounds]的高度来隐式获得此值。

您可以在此处找到常见的UIElement大小: http : //www.idev101.com/code/User_Interface/sizes.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM