Created
December 9, 2015 22:27
-
-
Save jacks205/35401905fed8761f1244 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
//: Playground - noun: a place where people can play | |
import UIKit | |
let view = UIView(frame: CGRectMake(0,0,286,54)) | |
view.backgroundColor = UIColor.clearColor() | |
let label = UILabel(frame: CGRectMake(24,8,238,32)) | |
label.textColor = UIColor.redColor() | |
label.text = "That email address is already taken! Try a different email address." | |
view.addSubview(label) | |
let mask = CAShapeLayer() | |
mask.frame = view.layer.bounds | |
mask.backgroundColor = UIColor.whiteColor().CGColor | |
let path = UIBezierPath() | |
path.moveToPoint(CGPointMake(10 , 0)) | |
//Top Right Corner | |
path.addLineToPoint(CGPointMake(mask.frame.width - 5, 0)) | |
path.addCurveToPoint(CGPointMake(mask.frame.width - 0, 5), | |
controlPoint1: CGPointMake(mask.frame.width - 5, 0), | |
controlPoint2: CGPointMake(mask.frame.width - 0, 0)) | |
//Bottom Right | |
path.addLineToPoint(CGPointMake(mask.frame.width - 0, mask.frame.height - 10)) | |
path.addCurveToPoint(CGPointMake(mask.frame.width - 5, mask.frame.height - 5), | |
controlPoint1: CGPointMake(mask.frame.width - 0, mask.frame.height - 10), | |
controlPoint2: CGPointMake(mask.frame.width - 0, mask.frame.height - 5)) | |
//Bottom Peak | |
path.addLineToPoint(CGPointMake(mask.frame.width / 2 + 7, mask.frame.height - 5)) | |
path.addLineToPoint(CGPointMake(mask.frame.width / 2, mask.frame.height)) | |
path.addLineToPoint(CGPointMake(mask.frame.width / 2 - 7, mask.frame.height - 5)) | |
//Bottom Left | |
path.addLineToPoint(CGPointMake(5, mask.frame.height - 5)) | |
path.addCurveToPoint(CGPointMake(0, mask.frame.height - 10), | |
controlPoint1: CGPointMake(5, mask.frame.height - 5), | |
controlPoint2: CGPointMake(0, mask.frame.height - 5)) | |
//Top Left | |
path.addLineToPoint(CGPointMake(0, 5)) | |
path.addCurveToPoint(CGPointMake(5, 0), | |
controlPoint1: CGPointMake(0, 5), | |
controlPoint2: CGPointMake(0, 0)) | |
path.closePath() | |
mask.path = path.CGPath | |
view.layer.insertSublayer(mask, atIndex: 0) | |
view |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment