meetpd meetpd - 2 years ago 104
Objective-C Question

Is it possible to programatically rotate the view by 180 degrees?

In my iPhone App, I want to programatically rotate the view by 180 degrees.

Is that possible, if yes how?


Answer Source

Should be possible by using CGAffineTransform

Quote from this question, this should do the trick:

CGFloat radians = atan2f(yourView.transform.b, yourView.transform.a);
CGFloat degrees = radians * (180 / M_PI);
CGAffineTransform transform = CGAffineTransformMakeRotation((90 + degrees) * M_PI/180);
yourView.transform = transform;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download