title: How could I make an "iPod Wheel" type control on iPhone?
body: <p>I want to create a sort of "iPod Wheel" control in a <code>Swift</code> project that I'm doing. I've got everything drawn out, but not it's time to actually make this thing work.</p>
  
  <p><a href="https://i.stack.imgur.com/nkukw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nkukw.png" alt="iPod Style Wheel"></a></p>
  
  <p>What would be the best way to recognize "spinning" so to speak, or to describe that more clearly, when the user is actively pressing the wheel and spinning his/her thumb around the wheel in a clockwise or counter-clockwise direction.</p>
  
  <p>I will no doubt want to use <code>touchesBegan</code>/<code>touchesMoved</code>/<code>touchesEnded</code>. What's the best way to figure out spinning though? </p>
  
  <p>I'm thinking</p>
  
  <p>a) determine in <code>touchesMoved</code> if the users touch is within circle, by determining the radius from the center point. Center point and radius are easily obtainable. Using these however, how can I determine the outer edge of the circle/wheel... to know whether the user is within the actually circle (their touch could still be in the view, but outside the actual wheel portion)</p>
  
  <p>b) Determine the current angle and how it has changed the previous angle. By that I mean... I would use the center point of the circle as one point, and the users current touch as the second point. This gives me my vector. I would also have a baseline angle. Likely center point to 12 c'clock. I would compare the two vectors (I already have a VectorMath class for this from something else I'm doing) and see my angle is 0. If the users touch were at 3 oclock, and I compared it to our baseline angle... I would see the angle is 90 degrees. I would continually calculate the angle, and perhaps every 5 degrees of change... would warrant a change in the controls output (depending on desired sensitivity).</p>
  
  <p>Does this seem like the best way to do this? I think this would be an ideal way, but am still not sure on how to calculate the circles outer edge, and determine if a users touch is within it.</p>