[英]IOS: How to display a document page by page in UIWebview
I need to display Pdf & Doc file format page by page. 我需要逐页显示Pdf和Doc文件格式。 I chooses UIWebview
for displaying documents. 我选择UIWebview
来显示文档。 But i cant able to display page by page or differentiate page from another page. 但我无法逐页显示或将页面与其他页面区分开来。
Here is my code: 这是我的代码:
//-- Getting file path from document directory
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *fileLocation = [NSString stringWithFormat:@"%@/sample.doc",documentsDirectory];
//--UIWebview initialization
UIWebView *myWebView=[[UIWebView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
myWebView.scalesPageToFit = YES;
myWebView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:fileLocation]]];
NSLog(@"%@",[NSURL fileURLWithPath:fileLocation]); // I
[self.view addSubview:myWebView];
Can anybody help how to display page by page. 任何人都可以帮助如何逐页显示。
Try UIDocumentInteractionController, i think its better. 尝试UIDocumentInteractionController,我认为它更好。
https://developer.apple.com/library/ios/documentation/uikit/reference/UIDocumentInteractionController_class/Reference/Reference.html https://developer.apple.com/library/ios/documentation/uikit/reference/UIDocumentInteractionController_class/Reference/Reference.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.