In our app we are supporting both orientations, however on selection of one
option we have to force user to remain only in portrait mode on all the
screens until he toggles it. So far we have found only this workable
solution:

[[UIDevice currentDevice] setValue:@(UIInterfaceOrientationLandscapeLeft)
forKey:@"orientation"];
[UINavigationController attemptRotationToDeviceOrientation];

Reference link: https://stackoverflow.com/a/26358192

The other solution which we tried is - returning NO from -shouldAutorotate
delegate. However the problem with this approach is that the delegate is
only called on currently displayed view controller not on previous view
controllers which might be behind it on navigation stack (or is presenting
view controller), hence only currently visible view controller starts
appearing in portrait mode, while previously displayed remain in landscape
mode.

I have two questions now:

Q1: Can our app be rejected from app store if we use the workable solution,
since we are trying to use the 'internal thing'?

Q2: What is the best approach to force set the orientation in app, at
runtime, say on tap of a button?
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to