注意: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解决方法 在AppDelegate.m中替换
return UIInterfaceOrIEntationMaskAll;
同
return UIInterfaceOrIEntationMaskLandscape;
像这样:
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrIEntationsForWindow:(UIWindow *)window{ return UIInterfaceOrIEntationMaskLandscape;}总结
以上是内存溢出为你收集整理的iphone – iOS – QLPreviewController – 如何阻止QuickLook旋转?全部内容,希望文章能够帮你解决iphone – iOS – QLPreviewController – 如何阻止QuickLook旋转?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)