2

I want to turn only one of my views within my app to landscape right. All my other views are in portrait mode. Previous view is in portrait mode. I pushed landscape view to portrait view. How can I do it correctly?

This portrait(rootviewcontroller)


This landscape

in my landscape view controller:

//Orientation
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{
    return (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
// New Autorotation support
-(BOOL)shouldAutorotate {
    return YES;
}

-(NSUInteger)supportedInterfaceOrientations{
    return UIInterfaceOrientationMaskLandscapeRight;
}
Bob
  • 1,351
  • 11
  • 28

3 Answers3

0

You can use this in you view controller

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

this will make sure the orientation is landscape right.

0

For changing the orientation in a device you can do sum thng like this..

-(void)viewDidLoad
{
    orientation = [[UIDevice currentDevice] orientation];
    if(intOrientation == UIInterfaceOrientationLandscapeRight)
                orientation = UIDeviceOrientationLandscapeRight;

}

Hope it helps you

ios54
  • 1
  • 1
  • 4
0

I've solved. Thanks Sang. I used this example:

Also see this

Or this

Community
  • 1
  • 1
Bob
  • 1,351
  • 11
  • 28