Orientation Portrait And Portraitupsidedown Only For One Window
Solution 1:
You need to use different windows and define for each window which orientation you want to allow.
I mean, you have to create loginWindow like this:
varloginWindow=Ti.UI.createWindow({orientationModes : [Ti.UI.PORTRAIT, Ti.UI.UPSIDE_PORTRAIT],fullscreen :false,navBarHidden :true});winPortrait.orientationModes= [Ti.UI.PORTRAIT, Ti.UI.UPSIDE_PORTRAIT];
Windows where you want to allow all orientations, have to been created like this:
varappWindow=Titanium.UI.createWindow({width :Ti.UI.FILL,height :Ti.UI.FILL,fullscreen :false,navBarHidden :true,orientationModes : [Ti.UI.PORTRAIT, Ti.UI.UPSIDE_PORTRAIT, Ti.UI.LANDSCAPE_LEFT, Ti.UI.LANDSCAPE_RIGHT]
});appWindow.orientationModes= [Ti.UI.PORTRAIT, Ti.UI.UPSIDE_PORTRAIT, Ti.UI.LANDSCAPE_LEFT, Ti.UI.LANDSCAPE_RIGHT];
Hope it helps
Solution 2:
Present your loginWindow as a modal view and after that set this methods for desired orientations.
- (BOOL) shouldAutorotate
{
returnNO;
}
- (NSUInteger) supportedInterfaceOrientations
{
returnUIInterfaceOrientationMaskPortrait;
}
Solution 3:
Using different orientation modes for a single app in iOS is not recommended. Please read Orientation design principles
Apple's Developer documentation says: "People expect to use your app in different orientations, and it’s best when you can fulfill that expectation." In other words, don't look at handling orientation as a bother but an opportunity.
Apple further recommends that when choosing to lock or support orientation, you should consider following these principles:
On iPhone/iPod Touch – Don't mix orientation of windows within a single app; so, either lock orientation for the whole app, or react to orientation changes.
On iPhone – don't support the portrait-upside-down orientation because that could leave the user with their phone upside-down when receiving a phone call.
However you can achieve orientation for particualr window using the orientationMode property of window
Post a Comment for "Orientation Portrait And Portraitupsidedown Only For One Window"