Using that code I'm creating a line from the first touch (touches began) and the last (touchEnded). But to make this shape dynamic (resize and move) I need to select it when I touch it. How can I do that?
shape.opacity = 1
shape.lineWidth = 2
shape.lineJoin = kCALineJoinMiter
shape.strokeColor = UIColor.blackColor().CGColor
shape.fillColor = UIColor.blackColor().CGColor
path.moveToPoint(firstPoint)
path.addLineToPoint(touchEnded)
shape.path = path.CGPath
drawView.layer.addSublayer(shape)
您可以使用手势识别器,然后将坐标传递给containsPoint()来查看您是否正在与形状进行交互。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.