ios - Sprite Kit game: over world in Portrait mode but battles in Landscape mode? -


so far game loads in portrait: main menu in portrait , game overworld (where player character roams around in) in portrait. need change orientation landscape mode when character begins battle (also, when player turns phone during battle mode, don't want phone change orientation & accidentally change portrait mode or vice-versa). battle mode skscene presented upon triggers. how change orientation of newly presented skscene landscape? can perform these changes inside individual skscene's or inside view controller? here current view controller code, regarding orientation:

-(bool)shouldautorotate {     return yes; }   -(nsuinteger)supportedinterfaceorientations {     if ([[uidevice currentdevice] userinterfaceidiom] == uiuserinterfaceidiomphone)     {         return uiinterfaceorientationmaskallbutupsidedown;     }     else     {         return uiinterfaceorientationmaskall;     } } 

here current code inside battle skscene - 1 want force landscape mode (turns out ugly since battle scene loads in landscape view controller still thinks we're in portrait... problem if rotate phone in way, orientation automatically rotated. need orientation fixed regrading phone movement):

-(void)didmovetoview:(skview *)view {     nsnumber *value = [nsnumber numberwithint:uiinterfaceorientationlandscaperight];     [[uidevice currentdevice] setvalue:value forkey:@"orientation"]; } 

that's problem because can manually change app's orientation if allowed in app settings. example, if check portrait mode later want go landscape mode, can't that.

to change orientation to, example, landscape left can use:

[[uiapplication sharedapplication] setstatusbarorientation:uiinterfaceorientationlandscapeleft  animated:no]; 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -