app需要支持两个屏幕方向,其中一些controller是固定竖屏,一些是固定横屏,我试了下stackoverflow中的这种方法,http://stackoverflow.com/questions/12520030/how-to-force-a-uiviewcontroller-to-portait-orientation-in-ios-6 但还是不管用啊,还有那个shouldAutorotateToInterfaceOrientation方法出设置断点也没反应,太奇怪了
后来通过覆写VC的这几个实现解决了
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
- (NSUInteger)supportedInterfaceOrientations
{
// return UIInterfaceOrientationMaskLandscapeLeft;
return UIInterfaceOrientationMaskLandscapeRight;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
return UIInterfaceOrientationLandscapeRight;
// return UIInterfaceOrientationPortrait;
}