Согласно Руководству по программированию ViewController для iOS , авторотация примерно контролируется ViewController, который был недавно сделан видимым.
В вашем случае это, вероятно, сам QLPreviewController
, а не ваш DocumentViewer
. (И вы говорите, что последний не называется shouldAutorotateToInterfaceOrientation:
, что согласуется с этой гипотезой).
Таким образом, авторотация контролируется shouldAutorotateToInterfaceOrientation:
методом QLPreviewController
, который в моем небольшом эксперименте, кажется, допускает все, кроме перевернутой ориентации.
Итак, вы можете определить подкласс QLPreviewController
, который переопределяет shouldAutorotateToInterfaceOrientation:
так, как вы это сделали в DocumentViewer
, и использовать этот подкласс вместо исходного QLPreviewController
.
LandscapeOnlyQLPreviewController.h:
#import <QuickLook/QuickLook.h>
@interface LandscapeOnlyQLPreviewController : QLPreviewController {
}
@end
LandscapeOnlyQLPreviewController.m:
#import "LandscapeOnlyQLPreviewController.h"
@implementation LandscapeOnlyQLPreviewController
- (BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) interfaceOrientation
{
return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}
@end