Created
November 20, 2014 02:11
-
-
Save rodericj/2a314bb0ee2fc8421dc0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a mask layer and the frame to determine what will be visible in the view. | |
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init]; | |
CGRect topMaskRect = CGRectMake(0, 0, 100, 10); | |
CGRect bottomMaskRect = CGRectMake(0, 33, 100, 10); | |
// Create a path with the top rect in it. | |
CGMutablePathRef path = CGPathCreateMutableCopy(CGPathCreateWithRect(topMaskRect, NULL)); | |
// now add the bottom rect to path | |
CGPathAddRect(path, NULL, bottomMaskRect); | |
// Set the path to the mask layer. | |
maskLayer.path = path; | |
// Release the path since it's not covered by ARC. | |
CGPathRelease(path); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment