Skip to content

Instantly share code, notes, and snippets.

@thinkclay
Created February 27, 2015 00:42
Show Gist options
  • Save thinkclay/254be40311f38dc113a2 to your computer and use it in GitHub Desktop.
Save thinkclay/254be40311f38dc113a2 to your computer and use it in GitHub Desktop.
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var buttonWithBorderLeft: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
// FYI: In storyboard, I explicetly set the height to 30 points
buttonWithBorderLeft.setTitle("Meow", forState: .Normal)
let path = UIBezierPath()
path.moveToPoint(CGPoint(x: 0, y: 0))
path.addLineToPoint(CGPoint(x: 0, y: 30))
let shapeLayer = CAShapeLayer()
shapeLayer.path = path.CGPath
shapeLayer.lineWidth = 3.0
shapeLayer.strokeColor = UIColor.grayColor().CGColor
shapeLayer.fillColor = UIColor.grayColor().CGColor
buttonWithBorderLeft.layer.addSublayer(shapeLayer)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment