0

I m working on one application in which i have splash screen and home screen. My Application is landscape and portrait mode application. When my application starts and i am on Landscape mode my home screen shows portrait mode for some mili seconds and after that it comes into the landscape mode. I want it should directly show the view in landscape mode.

Thanks

Android_D
  • 203
  • 5
  • 13

1 Answers1

0

I usually enable notifications:

[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];

On my controllers i put:

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{      
    [self configureOrientation:toInterfaceOrientation];
}

- (void)configureOrientation:(UIInterfaceOrientation)orientation
{  

    if(UIDeviceOrientationIsValidInterfaceOrientation(orientation)){

        if(UIInterfaceOrientationIsLandscape(orientation)){
            [self configureLandscapelView];
        }else if(UIInterfaceOrientationIsPortrait(orientation)){
            [self configurePortraitlView];
        }
    } 
}

You can also get the orientation from the UIViewController itself:

UIInterfaceOrientation orientation = [self interfaceOrientation];

Or from the status bar:

[UIApplication sharedApplication] statusBarOrientation]
alexandresoli
  • 918
  • 1
  • 9
  • 18