Friday, 15 February 2013

iphone - Force portrait orientation on pushing new view to UINavigationViewController -


I have a tabbed base application, which supports Landscape orientation only for a particular view (Rootview of a UINaviagtionController). Now I want to emphasize the portrait orientation for all other scenes for this navigation controller. I have tried to use

[[UIDevice currentDevice] SetOrrentation: UIDivisOrmentation Portate]

but it works very well but this code The piece is a private API call and I can not be at risk of app disapproval.

I have also tried to rotate the next scene manually but it will only rotate the view, not the navigation or tab bar.

Is there a similar way to force orientation change?

There is currently no way to do this. Take a look at this, I have the same problem with a tabbar application, you need to do everything that is autorotate, or nothing. You can find different answers on each scene for the urgency, but in fact it does not work. I do not know whether this is an intentional behavior or bug, anyway, the only viable solution that I know (using without document API) is to manage rotation by itself, and do not rely on autorotation.

It means in other words that you need to start Orientation Notification (see UID device, there are ways to start and stop information about device orientation), then you register for each view To rotate as an inspector, and manually manage the orientation, do not remember (where I have found this snippet):

  // changes the scene . CGAffineTransform transform = Cegfint TransformMarketation (M_PI / 2); Self.view.transform = transform;  

No comments:

Post a Comment