Search code examples
iphoneorientationuiinterfaceorientation

Weird behavior when changing orientation


I have a view with a pan gesture. I programmed its behavior perfectly on portrait mode, but when I change it to landscape mode its acting differently. The translation x,y are the same as in portrait mode which is what i would expect. But in many places it seems as the x and y are flipped.

Also, the width and height of the view stays the same. This is weird cause i would figure that the width should have a bigger value than the height right now. It doesn't.

I would love to give a piece of code but it looks like a general issue more than a specific bad line somewhere.

Can anyone help me figure this out?

Thanks


Solution

  • What you describe seems like normal behaviour if you implemented the handling of the pan-gesture yourself and don't account for the orientation change in it.

    The width and height of your views will stay the same if you don't have appropriate resizing masks set (or resize them in code when willAnimateRotationToInterfaceOrientation is called). Also, the frame of the application window ([[UIScreen mainScreen] bounds]) won't change after a rotation event.

    Is this what you are seeing?