Looks like there’s a new property of
CALayer that, according to documentation, allows you to specify which corners of a
CALayer receive the masking treatment when setting the
cornerRadius property. New value is called
maskedCorners and it takes a new
CACornerMask struct instance.
This should be really useful. Came upon it because I’m adding a padding view to the bottom of the DrinkSelector (The bottom bar of the main screen with the 5 drink type icons) to Drink Keeper for iPhone X support, and only wanted the rounded corners on the bottom to follow the screen. Looks like Apple knew exactly what I needed!
Apple’s online docs don’t have any information, but here is the doc block from Xcode.
/* Defines which of the four corners receives the masking when using
*cornerRadius' property. Defaults to all four corners. */`
@property CACornerMask maskedCorners
CA_AVAILABLE_STARTING (10.13, 11.0, 11.0, 4.0);
/* Bit definitions formaskedCorners' property. */`
typedef NS_OPTIONS (NSUInteger, CACornerMask)
kCALayerMinXMinYCorner = 1U << 0,
kCALayerMaxXMinYCorner = 1U << 1,
kCALayerMinXMaxYCorner = 1U << 2,
kCALayerMaxXMaxYCorner = 1U << 3,