2
aus dem Tutorial: http://swiftiostutorials.com/tutorial-draw-nice-triangle-view-border-cashapelayer/
schaffte ich es wie ein Dreieck zu erstellen:Form ein Dreieck mit UIView unterstützt von CAShapeLayer
class Triangle: UIView {
override func drawRect(rect: CGRect) {
let mask = CAShapeLayer()
mask.frame = self.layer.bounds
let width = self.layer.frame.size.width
let height = self.layer.frame.size.height
let path = CGPathCreateMutable()
CGPathMoveToPoint(path, nil, 0, 0)
CGPathAddLineToPoint(path, nil, width, 0)
CGPathAddLineToPoint(path, nil, width, height)
CGPathAddLineToPoint(path, nil, width/2, height)
CGPathAddLineToPoint(path, nil, width, height)
mask.path = path
self.layer.mask = mask
}
}
Aber was ich versuche zu erreichen, ist ein Dreieck wie :
Wie man das macht?
Ahh, nicht den zusätzlichen 'CGPathAddLineToPoint' bemerkt hat. Danke, Kumpel! – Orange