Programming





Triangle UIButton

Changing shape of UIButton to triangle is need to use UIBezierPath not frame. UIBezierPath can draw a figure with concat some points. By Configuring three points and connect it, we can writing triangle. Sample code is here. Sample code class TriangleButton: UIButton { private let bezierPath = UIBezierPath() override init(frame: CGRect) { super.init(frame: frame) setup() } required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) setup() } private func setup() { bezierPath.move(to: CGPoint(x: bounds.