1
試圖實現類似下面的圖片。圖像具有掩碼來顯示圖像的某個部分。下面是創建形狀斯威夫特圖片遮罩
let shape = CAShapeLayer()
shape.opacity = 0.5
shape.lineWidth = 2
shape.lineJoin = kCALineJoinMiter
let path = UIBezierPath()
path.moveToPoint(CGPointMake(0 , 0))
path.addLineToPoint(CGPointMake(200, 0))
path.addLineToPoint(CGPointMake(160, 200))
path.addLineToPoint(CGPointMake(0, 200))
path.closePath()
shape.path = path.CGPath
代碼有沒有一種方法來添加圖像到這一層。所以它的邊界是根據形狀設置的? BEFORE/AFTER圖像可以忽略。
任何線索將不勝感激。謝謝!
http://stackoverflow.com/questions/3059622/how-to-mask-a-uiview – emrys57