Last active
October 17, 2019 11:13
Revisions
-
JayachandraA renamed this gist
Oct 17, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ class ZigZagCardView: UIView { override func awakeFromNib() { layer.cornerRadius = 5 -
JayachandraA created this gist
Oct 17, 2019 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,34 @@ class GigZagCardView: UIView { override func awakeFromNib() { layer.cornerRadius = 5 layer.masksToBounds = true backgroundColor = UIColor.clear } override func draw(_ rect: CGRect) { super.draw(rect) let noOfZigs = 25 let path = UIBezierPath() let y = rect.size.height - 10 path.move(to: CGPoint(x: 0, y: 0)) path.addLine(to: CGPoint(x: 0, y: y)) path.addLine(to: CGPoint(x: 0, y: y)) let equalZig: Int = Int(rect.width/25) for i in 1...noOfZigs { path.addLine(to: CGPoint(x: CGFloat(equalZig*i), y: y-10)) path.addLine(to: CGPoint(x: CGFloat(equalZig*i)+10, y: y)) if i == noOfZigs{ path.addLine(to: CGPoint(x: rect.width, y: 0)) } } path.lineWidth = 10 path.close() UIColor.white.setFill() UIColor.white.setStroke() path.lineWidth = 10 path.stroke() path.fill() } }