OK,
I found the answer now myself.
It is not enough to have
- (BOOL)shouldAutorotate {
return YES;
}
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskAll;
}
in YOUR ViewController if it is pushed into a UINavigationViewController
.
The UINavigationViewController
also has to have those methods.
Preferably, you do this by having a small Category on UINavigationViewController
.
This is my UINavigationController-Rotation.h
:
@interface UINavigationController (Rotation)
@end
and my UINavigationController-Rotation.m:
#import "UINavigationController-Rotation.h"
@implementation UINavigationController (Rotation)
#pragma From UINavigationController
- (BOOL)shouldAutorotate {
BOOL result = self.topViewController.shouldAutorotate;
return result;
}
- (NSUInteger)supportedInterfaceOrientations {
NSUInteger result = self.topViewController.supportedInterfaceOrientations;
return result;
}
#pragma -
@end
Thanks for helping me!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…