Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIViewController device rotation delegate methods are not getting called in iOS5

I am developing an iPhone application. In this application, UIViewController (vc1) presents another UIViewController (vc2). vc1 supports both Portrait and Landscape orientations; vc2 supports only Portrait orientation.

  1. When vc2 is presented, it asks vc1: shouldAutorotateToInterfaceOrientation: and this returns YES
  2. In iOS5 (Beta 7) willRotateToInterfaceOrientation:, didRotateFromInterfaceOrientation: are not getting called for this sequence. But, this works fine in iOS4. Is this a bug in iOS5?
like image 465
spd Avatar asked Sep 16 '11 13:09

spd


1 Answers

I had reported a bug to Apple and I got the following reply:

"Engineering has determined that this issue behaves as intended based on the following information:

The presentation behavior is correct - if it behaved differently in previous versions, that was a bug. The arguably unexpected change in behavior regards the dismiss of VC1 which no longer gets rotation callbacks but it will layout in portrait.

There are other ways to determine what your orientation is when a view controller lays itself out. For various reasons, relying on the rotation callbacks proved to be problematic.

In general, viewController rotation callbacks occur in two cases:

  1. The device orientation changes for view controllers in the window hierarchy
  2. Mixed interface orientation presentations. (Bottom controller only supports portrait, device is in landscape, and a view controller that supports landscape is presented.) However this is arguably a misfeature.

Try using viewWillLayoutSubviews: in iOS 5."

like image 125
spd Avatar answered Jan 04 '23 04:01

spd