Skip to content

SPXMasking is category on CALayer that allows you to specify different a corner radius for each corner of a CALayer.

License

Notifications You must be signed in to change notification settings

shaps80/CornerMasking

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Purpose

SPXMasking is category on CALayer that allows you to specify different a corner radius for each corner of a CALayer.

Supported OS & SDK Versions

  • Earliest tested deployment target - iOS 8.0

ARC Compatibility

The SPXMasking category will work correctly ONLY with ARC enabled.

Installation

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.

Usage

To use, simple invoke setCornerRadii on any CALayer class

	self.view.layer.cornerRadii = SPXCornerRadiiMake(20, 60, 0, 120);

SPXMasking Extensions

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);

Example

Masking Example

About

SPXMasking is category on CALayer that allows you to specify different a corner radius for each corner of a CALayer.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published