0
votes

I've been working on this for days and can't crack it. The sequence of events is:

  • In landscape (let's just say right), the user hits an "edit" button.
  • A portrait only modal interface slides in. Its shouldAutorotateToInterfaceOrientation returns yes only for portrait.
  • The device becomes convinced it is in portrait mode.
  • Problem 1: If the user dismisses the interface without having actually rotated to portrait mode, the device reports that is in landscape right orientation (which it is), but the interface is laid out in portrait orientation.
  • Problem 2: If the user rotates to portrait, the interface does not get laid out again.
  • Problem 3: (And this one is weird) Rotating back to the same landscape orientation (right) where the edit button was pressed causes the status bar to return to landscape, but nothing else changes. All my stuff remains laid out in portrait mode. Rotating to the other (left) landscape orientation works perfect.

I need some way to force the layout engine to redo the layout for the orientation the device is actually in.

UIView - layoutSubviews, - setNeedsLayout, and -layoutIfNeeded don't have any effect.

Thanks for any help.

1
Please check my answer here....I think this helps you...... stackoverflow.com/questions/8090063/…Anshul Jain

1 Answers

0
votes

Do what iBooks (2.x) does and force the interface orientation to portrait with + (void)attemptRotationToDeviceOrientation. This way, you nip the problem in the bud at step one.