简体   繁体   English

iOS 8 和 9 中视图的角半径是多少?

[英]What is the corner radius for views in iOS 8 and 9?

iOS 9 changed the corner radius used for things like modal form sheets and action sheets. iOS 9更改了用于模态表单和操作表等内容的角半径 What is the new dimension, and what was the old from iOS 8 and previous?什么是新维度,什么是 iOS 8 和之前版本的旧维度?

My specific reason for asking is that I have a need to do a form sheet presentation on iPhone, so I'm doing my own custom modal transition animator.我问的具体原因是我需要在 iPhone 上做一个表单演示,所以我正在做我自己的自定义模式转换动画。 But I want to match the rounded corners of the system.但我想匹配系统的圆角。

For iOS 8 the corner radius is 4.对于 iOS 8,圆角半径为 4。

For iOS 9 the corner radius is 12.对于 iOS 9,圆角半径为 12。

There will still be a slight difference since the native controls seem to use custom not-really-circular rounding, but 99.9% of the users won't notice the difference even in side-by-side comparison.由于本机控件似乎使用自定义的非圆形舍入,因此仍然会略有不同,但 99.9% 的用户即使在并排比较中也不会注意到差异。

Just for clarifying, on iOS 10, iOS 11 and iOS 12 the corner radius is 13.只是为了澄清,在 iOS 10、iOS 11 和 iOS 12 上,圆角半径为 13。

Apart from that, if you don't want to check what's the corner radius for every OS, you can access to the view that contains that corner radius ( UIDropShadowView ) in the following way:除此之外,如果您不想检查每个操作系统的拐角半径是多少,您可以通过以下方式访问包含该拐角半径 ( UIDropShadowView ) 的视图:

- (void) viewWillAppear:(BOOL)animated {
   [super viewWillAppear:animated];

   CGFloat cornerRadius = self.navigationController.superview.layer.cornerRadius;
}

也可以使用例如: UISegmentedControl.new.layer.cornerRadius

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

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