In my view controller, I implement two methods for controlling interface orientation:
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOr
rather than using an integer to declare the orientation why don't you use a bool and plug in a if statement in there to detect whatever orientation you want. here is a example code that i hope would help you:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if (interfaceOrientation == UIInterfaceOrientationPortrait) {
return YES;
}
if (interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {
return YES;
}
return NO;
}
you can add all of the orientations in the if statement and it should work just fine. adrian
Edit:
and if you want to have an option for ios 6 the below code should work just fine for you.
- (BOOL) shouldAutorotate
{
return YES;
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown;
}
you can change just about all the supported orientations with this in ios 6. happy coding
EDIT 1:
to rotate only certain viewcontrollers
in a certain way, just use the ios 6 code that i posted above in all viewcontrollers
. here are the steps:
in the project level where all four internfaceorientations
are located, go ahean and turn everything off so app would go to default.
implement the ios 6 code that i supplied in all viewcontrollers
.
shouldautorotate
method.this should do the trick for you. happy coding