There is no way to always restrict a UIViewController to one orientation

Originator:Lee.Falin
Number:rdar://6399924 Date Originated:25-Nov-2008
Status:Duplicate/5855845 Resolved:
Product:iPhone SDK Product Version:2.2
Classification:Serious Bug Reproducible:Always
 
Summary:

When a UIViewController is part of a UINavigationController, the behavior defined in 

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

is ignored.

Steps to reproduce:

- Create UIViewController and have shouldAutorotateToInterfaceOrientation only return YES for portrait mode.
- Create a second UIViewController and have shouldAutorotateToInterfaceOrientation always return YES
- Use a UINavigationController to push the second view controller onto the navigation stack
- Rotate the device
- Use the UINavigationController's back button to go back to pop the second controller off the stack.

Expected Results:

Since the first view controller says it doesn't support landscape mode, it should not be rotated.

Actual Results:

shouldAutorotateToInterfaceOrientation is ignored, and the view is rotated anyway.

Sample Code: http://leefalin.com/projects/code/radar_6399924.zip

02-Dec-2008 09:30 PM from Apple, they are aware of and are tracking this issue under bug id 5855845.

Comments

Help

This needs to be changed.

By megacron1 at Feb. 7, 2011, 3:53 a.m. (reply...)

This makes no sense

Why would something like this be overlooked?

By james.jones at Jan. 25, 2011, 8:28 p.m. (reply...)

Nice Job, Apple

So this annoying bug comes a really long way from iOS 1 to iOS 4.

Let's duplicate this bug report and let Apple know we really want it fixed. I've just reported it again under the bug ID 8478525.

I have the same (frustrating) issue, and I've logged a radar (6409481).

I'm implementing support for landscape orientation through and through. It isn't too hard, but I'm noticing that performance is lacking.

Brian M. Criscuolo Mark/Space, Inc.

Ran into this myself. Definitely sounds like a bug to me.

My workaround - disable the "back" button while the device is in landscape mode. Total hack, but gets around the problem for now.

Thanks

Thanks for your complete bug report. I am in the very same case.

By hugele.aurelien at Nov. 25, 2008, 5:17 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!