我有 QuickLook (QLPreviewController) 几乎可以按我的意愿工作,但是由于图像特性,我不希望它旋转到纵向。我在“shouldAutoRotateToInterfaceOrientation”方法中配置了它,只为横向旋转返回是(请参阅下面的代码以获取详细信息),但它仍在旋转到纵向。
注意: shouldAutoRotateToInterfaceOrientation 是一个直接副本,用于该项目的所有视图控制器,并且它在其他视图控制器中工作。
//
// documentViewer.m
//
#import "DocumentViewer.h"
@implementation DocumentViewer
@synthesize documents;
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft)
return YES;
else if (interfaceOrientation == UIInterfaceOrientationLandscapeRight)
return YES;
else
return NO;
}
- (void)viewDidLoad {
[super viewDidLoad];
}
//-(void)viewWillAppear:(BOOL)animated {
//
// self.userInteractionEnabled = YES;
//}
//Nessary for Enabling User Interaction
- (BOOL)canBecomeFirstResponder {
return YES;
}
-(void) createList:(NSString *) document {
documents = [[NSArray arrayWithObjects:document, nil] retain];
}
-(NSInteger) numberOfPreviewItemsInPreviewController: (QLPreviewController *) controller {
return [documents count];
}
- (id <QLPreviewItem>) previewController: (QLPreviewController *) controller previewItemAtIndex: (NSInteger) index {
return [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:[documents objectAtIndex:index] ofType:nil]];
}
@end