ZacharyDeeplet / FingerCMS-iOS

Finger CMS for iOS
0 stars 0 forks source link

iOS app always starts in Portrait mode, even if device is in Landscape orientation #14

Open ZacharyDeeplet opened 9 years ago

ZacharyDeeplet commented 9 years ago

We will save FingerCMSHD orientation when "app will terminate" and use the orientation as the next startup orientation. Reference Code: in AppDelegate

in ViewController BOOL firstTime = true; ...

-(NSUInteger)supportedInterfaceOrientations { NSInteger orientation;

if  (firstTime) {
    orientation = [[NSUserDefaults standardUserDefaults] integerForKey:@"Orientation"];
    switch (orientation) {
        case UIInterfaceOrientationPortrait:
            orientation =UIInterfaceOrientationMaskPortrait;
            break;
        case UIInterfaceOrientationLandscapeLeft:
            orientation =UIInterfaceOrientationMaskLandscapeLeft;
            break;
        case UIInterfaceOrientationLandscapeRight:
            orientation =UIInterfaceOrientationMaskLandscapeRight;
            break;
    }
} else {
    orientation =UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight;
}
return orientation;

} ...