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

newbie80

macrumors member
Original poster
Mar 2, 2011
51
0
Hi,

I have the following codes for CGAffineTransformMakeRotation
Code:
float tempF = atan2(location.y - plans_shapea.center.y, location.x - plans_shapea.center.x);
        
        [UIView beginAnimations:@"animation" context:nil];
        CGAffineTransform viewTransform = CGAffineTransformMakeRotation(tempF);
        
        plans_shapea.transform = viewTransform;
        [UIView commitAnimations];
        
        [statusRotate setText:[NSString stringWithFormat:@"%d",tempF]];
        
        if(tempF == 0 || tempF == 1610612736){
            NSLog(@"success");
        }
        if(tempF != 0){
            NSLog(@"fail");
        }

I trace the value for "tempF", but when I rotate to 12 o'clock, 3 o'clock, 6 o'clock and 9 o'clock, they gave me the same value which is 0. I would like to know how do I get all different values? or maybe is there other way for me to change it to degrees from 0 to 360 degrees?
Any help will be appreciated.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.