Я работаю с этим примером кода RotationPie. Это колесо, и я хочу двигать или вращать его в своем проекте ТОЛЬКО в одном направлении. Я хочу поставить разные варианты и пользователь должен будет выбрать один из них. Я хотел, чтобы колесо вращалось только в одном направлении. Я думаю, что мне нужно что-то изменить в этом методе в классе CDCircleGestureRecognizer, но я не знаю, что.
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
if ([self state] == UIGestureRecognizerStatePossible) {
[self setState:UIGestureRecognizerStateBegan];
} else {
[self setState:UIGestureRecognizerStateChanged];
}
// We can look at any touch object since we know we
// have only 1. If there were more than 1 then
// touchesBegan:withEvent: would have failed the recognizer.
UITouch *touch = [touches anyObject];
// To rotate with one finger, we simulate a second finger.
// The second figure is on the opposite side of the virtual
// circle that represents the rotation gesture.
CDCircle *view = (CDCircle *) [self view];
CGPoint center = CGPointMake(CGRectGetMidX([view bounds]), CGRectGetMidY([view bounds]));
CGPoint currentTouchPoint = [touch locationInView:view];
CGPoint previousTouchPoint = [touch previousLocationInView:view];
previousTouchDate = [NSDate date];
CGFloat angleInRadians = atan2f(currentTouchPoint.y - center.y, currentTouchPoint.x - center.x) - atan2f(previousTouchPoint.y - center.y, previousTouchPoint.x - center.x);
CGFloat one = atan2f(currentTouchPoint.y - center.y, currentTouchPoint.x - center.x);
CGFloat two =atan2f(previousTouchPoint.y - center.y, previousTouchPoint.x - center.x);
currentTransformAngle = atan2f(view.transform.b, view.transform.a);
[self setRotation:angleInRadians];