Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

ios

uikit

ios9

iOS 9 changed the corner radius used for things like modal form sheets and action sheets. What is the new dimension, and what was the old from iOS 8 and previous?

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. But I want to match the rounded corners of the system.

like image 957
Tom Hamming Avatar asked Sep 21 '15 14:09

Tom Hamming


2 Answers

For iOS 8 the corner radius is 4.

For iOS 9 the corner radius is 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.

like image 163
virusman Avatar answered Sep 18 '22 14:09

virusman


Just for clarifying, on iOS 10, iOS 11 and iOS 12 the corner radius is 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:

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

   CGFloat cornerRadius = self.navigationController.superview.layer.cornerRadius;
}
like image 25
JonyMateos Avatar answered Sep 21 '22 14:09

JonyMateos