views:

1633

answers:

1

How can I manually rotate a view using the autoresizingMasks, as if the user had rotated the phone and it had auto-rotated. Also I want it to be instant, no animation. I you want to know why I need this, look at my other question at http://stackoverflow.com/questions/1219988/iphone-dev-keeping-interface-rotation.

Thanks!!

A: 

What you want to do here is use Affine transforms to rotate your View, I have accomplished this though i dont have the code infront of me at the moment. If you do a simple rotation youll find that your view will be cut off and not in the center like youd want, what you need to do here is set the anchor of your layer (play around with the value till you get what you want) in order for the view to appear where you want it. The way to approach this is just do the 90 degree affine transform rotation and see the effects it has on the view. This way you should be able to figure out where you layers anchor needs to be. Ill post some sample code here later when I am infront of my mac. Hope it helps

Daniel
Will I be able to rotate a view using it and its contents autoresizingMasks? And how do I do an affine transform?
Mk12
No you wont, you will have t o do the resizing yourself, look up affine transforms in the apple site they have something here http://developer.apple.com/iphone/library/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_affine/dq_affine.html
Daniel
i guess i misread your question about the autoreszingmasks
Daniel