Need help on CGAffineTransformMakeRotation rotation value

Discussion in 'iOS Programming' started by newbie80, May 10, 2011.

  1. macrumors member

    Joined:
    Mar 2, 2011
    #1
    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.
     

Share This Page