Objective-c – Programmatically change view orientation without rotating ipad

ipadiphoneobjective corientationrotation

I would like to rotate a ViewController based on some condition. The problem with shouldAutorotateToInterfaceOrientation is that the view always start with portrait/landscape orientation (as set in Interface Builder) and the user has to rotate the ipad to use the correct mode…. How can I change this behavior?
Thank you.

Best Answer

Apply a transform to the view.

view.transform = CGAffineTransformMakeRotation(M_PI);

You can use UIView animations to animate the change.

Related Topic