iphone Programming Glossary: cgpointdistance
Using UIPinchGestureRecognizer to scale uiviews in single direction http://stackoverflow.com/questions/6759028/using-uipinchgesturerecognizer-to-scale-uiviews-in-single-direction CGPoint currentTouchLocation gestureRecognize locationInView yourViewHere CGPoint deltaMove CGPointDistance currentTouchLocation lastTouchPosition float distance sqrt deltaMove.x deltaMove.x deltaMove.y deltaMove.y hScale abs deltaMove.x.. CGPoint currentTouchLocation gestureRecognize locationInView yourViewHere CGPoint deltaMove CGPointDistance currentTouchLocation lastTouchPosition float distance sqrt deltaMove.x deltaMove.x deltaMove.y deltaMove.y float hScale.. It does an absolute calculate while the first implementation does a relative one. Note that you need also define CGPointDistance to calculate the distance between the two touches and choose which view are your going to use to calculate the distance..
|