Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

rahulvyas

macrumors newbie
Original poster
May 6, 2009
20
0
Hello all,
i am new to iphone development.
i am creating a game in which we have to hold a cup(UIimageview) while holding when i move my finger to right then rotate cup slightly to left and if i move finger left rotate cup to right.So what is the best possible way to do this.I have tried UIView animation but it's very fast.ALso how do i pass angel of rotation?
 
you can control the animation block duration with setAnimationDuration:

Code:
[UIView setAnimationDuration:kSpeedInSecondsOfAnimation];

use CGAffineTransformMakeRotation to rotate your image object. it rotates in radians, so i've included a macro that will allow you to enter a degree.

Code:
#define kDegreesToRadians(x) (M_PI * (x) / 180)

CGAffineTransform transform = CGAffineTransformMakeRotation(kDegreesToRadians([I]angel[/I]));
yourView.transform = transform;
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.