Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.
Banging my head against a wall here. I think I'm missing something elementary.
Here is what I would like to accomplish:
1. Display a UIImageView with a graphic of a volume knob. 2. Detect swipeRight/swipeLeft gesture. 3. Rotate the image in radians + or - based on the direction of the swipe.
Eventually I would like to be able to "scale" the rotation based on the distance of the swipe, but for now, I'm just trying to get a basic working model.
Here's the problem:
I can do all 3 steps, however I am using a CGAffineTransformMakeRotation(radians)
If I swipe in the opposite direction, it treats the original "zero angle" AS 0 radians, whereas I need to 'reset' the zero angle after the first animation.
Any thoughts? Is it just simple logic I'm missing??
If you want 1:1 movement you might skip the animation function. This is fine if you want it to autorotate a set amount but for interaction you might as well just set it directly immediately.
You could calculate the degrees around using atan2(?) relative to the the center. (i.e. touch is x,y relative to center xy so it's z degrees) As you move your finger you recalc and use the difference to rotate.
If you want 1:1 movement you might skip the animation function. This is fine if you want it to autorotate a set amount but for interaction you might as well just set it directly immediately.
I do want interaction, but I guess I'm confused as to the way to "set" the rotation. The CGAffineTransformMakeRotation on every swipe method call is giving me weird erratic results (using the code block above) whether I call the UIView animation methods or not...
Something simple I'm missing?
----EDITED------
Thanks Scott. It turns out that the rotation does work. It appears to be a problem with my swipe method detection that is giving erratic results.
/*implemented this to test the progressive rotation, it works if([touch tapCount] == 2) { turnRadians += singleTurnRadians; knobView.transform = CGAffineTransformMakeRotation(turnRadians); } */
Replies
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeAny suggestion on how to do that exactly? I've tried a number of things including:
But that still does not working properly. Somehow the behavior of CGAffineTransformMakeRotation(angle) doesn't seem to get the job done... :(
Any code suggestions?
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeYou could calculate the degrees around using atan2(?) relative to the the center.
(i.e. touch is x,y relative to center xy so it's z degrees)
As you move your finger you recalc and use the difference to rotate.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeSomething simple I'm missing?
----EDITED------
Thanks Scott. It turns out that the rotation does work. It appears to be a problem with my swipe method detection that is giving erratic results.
Here is what I have:
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome