Search code examples
iphoneobjective-cios6uiinterfaceorientationdevice-orientation

Orientation Issues in ios 6.0


I have already completed my app in portrait orientation for iPhone and iPad, Now i need this same for the landscape orientation , I was used only xib's for both iPhone & iPad .and some UI are created in programatically. Just now i was Use this code:

-(NSUInteger)supportedInterfaceOrientations
{
    // return your mask here e.g.:
    if(UIDeviceOrientationIsPortrait([[UIDevice currentDevice] orientation]))
        return UIInterfaceOrientationMaskPortrait;
    else
        return UIInterfaceOrientationMaskLandscape;
}

but it does not work properly, so can anyone help me......?


Solution

  • Change this code to the following:

    -(NSUInteger)supportedInterfaceOrientations
    {
        return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscape;  
    }
    

    And add the following:

    - (BOOL) shouldAutorotate
    {
        return YES;
    }