xcodeでアプリを作っている物ですが、実装の仕方がわからないため質問させていただきます。
行いたい処理としましては、Iphone上で線を書いたときに、その線の長さに応じて、線を指定の数に分割し、分割した線の角度を算出したいということを行いたいのですが、
座標を取得するのは、
override func touchesBegan(touches: NSSet, withEvent event: UIEvent) {
startPoint = touches.anyObject()?.locationInView(self)
}
override func touchesMoved(touches: NSSet, withEvent event: UIEvent) {
movePoint = touches.anyObject()?.locationInView(self)
startPoint = movePoint
}
override func touchesEnded(touches: NSSet, withEvent event: UIEvent) {
endPoint = touches.anyObject()?.locationInView(self)
}
線を書いてる(touchesMovedメソッド中)に角度を算出すればよいかなと思ったのですが、最終的な線の長さがわからないと分割数が決定できないので、touchesEndedメソッド後に線の長さを算出し、分割数を決定し、それに応じて分割する座標点を知る必要があると思うのですが、その方法がいまいちつかめません。
アドバイス頂けると嬉しいです。