The unusual bottom corners of an iPhoneX are Apple's new (2017) "continuous corners for iPhoneX".
It is trivial for any experienced iOS programmer to approximate the curve, but:
Does anyone know exactly how to achieve these, exactly as Apple does?
Even if it's a private call, it would be good to know.
It does seem bizarre that Apple have not explained this.
Please note that it's trivial to "approximate" the curve:
To repeat,
it is trivial for any experienced iOS programmer to approximate the curve.
The question being asked here is specifically how to do Apple actually do it?
Please do not post any more answers showing beginners how to draw a curve and approximate the iPhone curve.
As of iOS 13, there's an API available for this:
https://developer.apple.com/documentation/quartzcore/calayercornercurve
See
CALayerCornerCurve.continuous
I wrote an experimental class which constructs a bezier path which overlaps the border of a
CALayer
due to @Aflah Bhari's comments. The layer has set its private propertycontinuousCorners
toYES
. This is the result:The border of the layer is blue while the color of the path is red.
Here is the code. You can set
radius
andinsets
in attribute inspector of Interface Builder. I have created the image above by setting the class of the view controllers view toArcView
, its radius to30.0
and the insets to(20.0, 20.0)
.Here is the code:
ArcView.h
ArcView.m
I hope this helps you with your problem. I've found the factor of
1.2
fortheOffset
through experiments. You might modify this value if necessary. The value I have chosen for the radius is not optimal and can certainly be improved. But since it depends on the exact distance from the rim, I didn't invest much time for it.