
- (IBAction)prevIEwdocument:(ID)sender { Nsstring *filePath = [[NSBundle mainBundle] pathForResource:@"sample" ofType:@"pdf"]; // Initialize document Interaction Controller self.documentInteractionController = [UIdocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:filePath]]; // Configure document Interaction Controller [self.documentInteractionController setDelegate:self]; // PrevIEw pdf [self.documentInteractionController presentoptionsMenuFromrect:down.frame inVIEw:self.vIEw animated:YES];} 我已经读过,我们也可以通过UIdocumentInteractionController从其他应用程序中读取应用程序中的文件.
在我的应用程序中,如何使用UIdocumentInteractionController从其他应用程序中读取文件?这一切是如何发生的?
解决方法 预览pdf文档和共享.设置委托方法: –
UIdocumentInteractionControllerDelegate
NSURL *URL = [[NSBundle mainBundle] URLForResource:@"Your pdf @R_404_6889@" withExtension:@"pdf"];UIdocumentInteractionController *documentInteractionController =[UIdocumentInteractionController interactionControllerWithURL:URL];documentInteractionController.delegate = self;[documentInteractionController presentPrevIEwAnimated:YES];- (UIVIEwController *) documentInteractionControllerVIEwControllerForPrevIEw: (UIdocumentInteractionController *) controller {return self;} 如果您有任何疑惑,请单击以下链接并阅读:
https://developer.apple.com/library/ios/documentation/FileManagement/Conceptual/DocumentInteraction_TopicsForIOS/Articles/PreviewingandOpeningItems.html
以上是内存溢出为你收集整理的ios – 通过UIDocumentInteractionController打开文件全部内容,希望文章能够帮你解决ios – 通过UIDocumentInteractionController打开文件所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)