SPXMasking is category on CALayer that allows you to specify different a corner radius for each corner of a CALayer.
- Earliest tested deployment target - iOS 8.0
The SPXMasking category will work correctly ONLY with ARC enabled.
To use the SPXMasking category in an app, just drag the category files into your project and import the header file into any class where you wish to make use of the SPXMasking functionality.
To use, simple invoke setCornerRadii on any CALayer class
self.view.layer.cornerRadii = SPXCornerRadiiMake(20, 60, 0, 120);
This method will apply a corner radius to the specified corners of the CALayer
- (void)setCornerRadii:(SPXCornerRadii)cornerRadii;
This method will return the current mask path. This is useful when needing to set shadowPath on a layer to optimize shadow drawing
- (UIBezierPath *)maskPath;
This method is provided as a convenience for specifying corner radii
extern SPXCornerRadii SPXCornerRadiiMake(CGFloat bottomLeft, CGFloat topLeft, CGFloat topRight, CGFloat bottomRight);
This method will compare two SPXCornerRadii structures and return YES if they are equal, NO otherwise
extern bool SPXCornerRadiiEquals(SPXCornerRadii radii1, SPXCornerRadii radii2);