Alessio Crestani
Alessio Crestani

Reputation: 1612

ios 8 Orientation Issue

my application, developed in iOS7, has a forced orientation base on device: iphone -> portrait Ipad -> landscape

With iOS8, if my apps on ipad starts in portrait mode, it will show the app in landscape but the result is:

enter image description here

How to fix iOS 8 orientation?

Upvotes: 3

Views: 2381

Answers (3)

Hardik Mamtora
Hardik Mamtora

Reputation: 1652

My issue was related to UIWindows frame which was going in minus. So made the code as below in MyViewController -(NSUInteger)supportedInterfaceOrientations Method

[[UIApplication sharedApplication] setStatusBarHidden:NO];

[self.view setFrame:CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height)];

[appDel.window setFrame:CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height)];

Try this.

Upvotes: 0

Abdul Yasin
Abdul Yasin

Reputation: 3508

- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {



if ([window.rootViewController isKindOfClass:[UINavigationController class] ]) {

    if ([[window.rootViewController presentedViewController]
         isKindOfClass:[SignatureViewController class]]) {
        return UIInterfaceOrientationLandscapeRight;
    }

    return UIInterfaceOrientationMaskPortrait;
}

    return UIInterfaceOrientationMaskPortrait;

}

Upvotes: 4

Alessio Crestani
Alessio Crestani

Reputation: 1612

I'm not sure if I can answer my own questions, but I have resolved the issue using

[self.window setFrame:[[UIScreen mainScreen] bounds]];

at the end of (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions method.

Upvotes: 6

Related Questions