I started to read Beginning iPhone Game Development by Apress. I decided to experiment a little to better understand so I created a Color wheel in Photoshop that was 250 x 250. I made the view background black and the edges of my wheel black.
I used this code which I wrote to turn the wheel which it does just fine.
The problem is that when I take my finger off of the wheel and place it someplace else to turn the wheel the wheel's rotation snaps to the new CGPoint location. The interesting thing is that when it spans to the new location it is the right side of the disc (I know the right side of a circle)
Since this is new territory for me I thought I would check to see if there is anything that I am unaware of to adjust for this offset? Or a different approach to spinning the wheel. I don't want to continue down the wrong path if I am.
I used this code which I wrote to turn the wheel which it does just fine.
Code:
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
UITouch *touch = [[event allTouches] anyObject];
CGPoint touchLocation = [touch locationInView:touch.view];
tempF = atan2(touchLocation.y - theDisc.center.y, touchLocation.x - theDisc.center.x);
theDisc.center = CGPointMake(theDisc.center.x, theDisc.center.y);
theDisc.transform = CGAffineTransformMakeRotation(tempF);
theValue.text = [NSString stringWithFormat:@"%f",tempF];
}
The problem is that when I take my finger off of the wheel and place it someplace else to turn the wheel the wheel's rotation snaps to the new CGPoint location. The interesting thing is that when it spans to the new location it is the right side of the disc (I know the right side of a circle)
Since this is new territory for me I thought I would check to see if there is anything that I am unaware of to adjust for this offset? Or a different approach to spinning the wheel. I don't want to continue down the wrong path if I am.