touchesBeganとtouchesMoved点から作成したUIBezierPath配列があります。 私はそれらの描画を画面にアニメーション化したいと思います。UIBezierPath配列のアニメーション図面
ベゼルを繰り返し実行してsetNeedsDisplay()を呼び出さなければ、最良の方法はありますか?
おかげ
override func draw(_ rect: CGRect) {
for bezier in beziers{
bezier.stroke()
}
}
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesBegan(touches, with: event)
let cgPoint = touches.first!.location(in: self)
let bezierPath = ColorBezierPath() // subclass of UIBezierPath
bezierPath.lineWidth = lineWidth
bezierPath.color = color
bezierPath.move(to: cgPoint)
beziers.append(bezierPath)
}
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesMoved(touches, with: event)
let cgPoint = touches.first!.location(in: self)
let bezierPath = beziers.last
bezierPath?.addLine(to: cgPoint)
setNeedsDisplay()
}
要件は描画アプリケーションに関連していますか? –
@PraveenKumarはい、 "Draw Something"に似ています。UIBezierPath配列を保存して後でアニメーションの描画を描画したいのですか? – Maor
後で何を意味するのですか?何かを描画するたびにユーザーを見せたくないですか? ! –