An open API service indexing awesome lists of open source software.

https://github.com/shaps80/cornermasking

SPXMasking is category on CALayer that allows you to specify different a corner radius for each corner of a CALayer.
https://github.com/shaps80/cornermasking

Last synced: 8 months ago
JSON representation

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

Awesome Lists containing this project

README

          

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