Just written my first custom UIGestureRecognizer


HFRotationalPanRecognizer is for handling rotational drags and you can find it here. I needed it for a fixed wheel where the two fingered rotation would be inappropriate and confusing. It is suitable for wheels, dials and other fixed rotating issues.

It wasn't too bad once I had my head around it. This article and Erica's book (well I have the iOS 5 version) helped. The key things to remember are to set the gesture state for each move in the gesture as that triggers the update. I also used the same style as the UIPanGestureRecognizer for reporting the move by accumulating it through the gesture but allowing it to be reset by the handler for incremental updates.

I did have quite a bit of trouble sorting out the origin and finished with it settable but always in the superview's co-ordinate space.