nivritgupta
nivritgupta

Reputation: 1966

Iphone Portraits mode switching back to landscape Mode is not Working Automatically

enter image description hereMy app launches in Portraits mode correctly and works great , But in my Application Some Views Support Landscape mode only and some Both landscape and Portraits, when i Switch the application view from Only Landscape Supported to some view that support both orientation and rotate the Device to Portraits and Hit The Back Button , the Landscape view is not rotated Automatically

i use the following code to set the orientation

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return YES;
}


- (BOOL)shouldAutorotate
{
    return YES;
}




- (NSInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscapeLeft;
}

Thanks

Upvotes: 0

Views: 237

Answers (1)

Engnyl
Engnyl

Reputation: 1380

Edit these lines

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return YES;
}

As

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    if (toInterfaceOrientation == UIInterfaceOrientationMaskLandscapeLeft) {
        return YES;
    }
    else {
        return NO;
    }
}

Upvotes: 2

Related Questions