私は QuickLook (QLPreviewController) をほぼ希望どおりに動作させていますが、画像の特性のため、縦向きに回転させたくありません。「shouldAutoRotateToInterfaceOrientation」メソッドで、横向きの回転に対してのみ yes を返すように構成しています (を参照)。詳細については以下のコードを参照してください) が、まだ縦方向に回転しています。
注: 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