ios - supportedInterfaceOrientationsForWindow returns UIInterfaceOrientationMaskPortrait but my viewcontroller show in landscape -
i handling orientations in appdelegate.m
file. supportedinterfaceorientationsforwindow
returns uiinterfaceorientationmasklandscape
of view controllers , uiinterfaceorientationmaskportrait
1 viewcontroller.
when move landscape viewcontroller viewcontroller want portrait supportedinterfaceorientationsforwindow
returns uiinterfaceorientationmaskportrait
view controller appears in landscape.
please me i've been stuck long time. testing on iphone 6, ios 9.
let's view a
1 of landscape views of app , b
intended portrait view. now, when device held in portrait on , b accessed, view doesn't change orientation portrait (since device in portrait).
i'd suggest 'tell' system b in landscape while preparing segue , in viewdidload
b's view controller, change orientation portrait.
this way, no matter previous view's orientation, b open in portrait when loads.
use following code change orientation. in case using segue use code in
- (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender{ nsnumber *value = [nsnumber numberwithint:uiinterfaceorientationlandscapeleft]; [[uidevice currentdevice] setvalue:value forkey:@"orientation"]; }
the orientation here should opposite of desired orientation in next view controller.
Comments
Post a Comment