iPad2 is stay portrait for a second before move to landscape

43 views Asked by At

We have an app-which is ONLY landscape, that works great on ALL apple devices . It also has the launch images . We are lost with this bug.

We have set the app for landscape only in the device orientation menu. All views are positioning in code only.

What happens on iPad2(iOS7) ONLY , is when you switch between views, you see for a second a portrait mode (which looks bad because graphics is for landscape only-so image is on half screen) and than it switch back to the landscape back after a second.

For some other views , the iPad2 ONLY stay forever on portrait for some reason -that means we see the graphics on half screen .its not positioned right .

the size of the screen that we get is just fine

    float width=[UIScreen mainScreen].bounds.size.width;
        float height=[UIScreen mainScreen].bounds.size.height;
768/1024

**** views that made with storyboard are ok- the others that positioning made with software are bad.

1

There are 1 answers

0
ares777 On

I use the following code (based on link given in above comment):

        BOOL OSIsBelowIOS8 = [[[UIDevice currentDevice] systemVersion] floatValue] < 8.0;
        if(OSIsBelowIOS8) {
            if( [ [ UIScreen mainScreen ] respondsToSelector: @selector( nativeBounds ) ] )
            {
                self.window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] nativeBounds]];
            }
            else
            {
                self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
            }
        }  else {
            self.window = [[UIWindow alloc] initWithFrame: [self screenBoundsOrientationDependent] ];
        }

and this is my screenBoundsOrientationDependent

    //Always return the iOS8 way - i.e. height is the real orientation dependent height
    - (CGRect)screenBoundsOrientationDependent {
        UIScreen *screen = [UIScreen mainScreen];
        CGRect screenRect;
        if (![screen respondsToSelector:@selector(fixedCoordinateSpace)] && UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) {
            screenRect = CGRectMake(screen.bounds.origin.x, screen.bounds.origin.y, screen.bounds.size.height, screen.bounds.size.width);
        } else {
            screenRect = screen.bounds;
        }
        return screenRect;
    }