Search code examples
iosuiinterfaceorientation

setAutoresizeMask does not work when Orientation changes on iPad


I have miserable and hard-to-belive problem:

  1. I have View controller with self.view created in IB
  2. I have added some controls on it
  3. I have overrided shouldAutorotateToInterfaceOrientation: with return YES;
  4. I have set autoresizeMask to one control for flexible height, expecting to be shrunk when changing to Lanscape mode.

However, it does't happen... Any ideas?


Solution

  • I'd recommend one of a view things:

    1. Check your main view has its own resizing set to have flexible height.

    2. Check that your view doesn't have autoresizing flexible top and bottom margins.

    3. You say that this is a "control" - if it is a UIKit control, its probable that Apple doesn't allow changing it to have flexible heights. Take for example UISwitch. A flexible switch couldn't resize width or height as it is system drawn for its size. This may apply to any other UIKit-defined control where the autoresizing mask isn't appropriate to it's display.