【问题标题】:Displaying the pdf file in any one of the pdf app downloaded in my ipad在我的 ipad 中下载的任何一个 pdf 应用程序中显示 pdf 文件
【发布时间】:2014-02-03 06:39:19
【问题描述】:

有没有办法通过下载到我的 IOS 应用程序中的任何 PDF 编辑器应用程序直接重定向到 IOS 应用程序以显示我的 pdf 文件?

请给我任何建议。

提前致谢。

【问题讨论】:

    标签: ios objective-c ipad pdf


    【解决方案1】:

    检查一下

     NSString *stringURL = @"ibooks://";
     NSURL *url = [NSURL URLWithString:stringURL];
     [[UIApplication sharedApplication] openURL:url];`  
    

    您可以从this link.获得帮助

    打开pdf文件的修改代码

    #import "ViewController.h"
    @interface ViewController ()<UIDocumentInteractionControllerDelegate>
    @property (strong, nonatomic) UIDocumentInteractionController *controller;
    @end
    
    @implementation ViewController
    - (IBAction)openDocument:(id)sender {
    
    NSURL *URL = [[NSBundle mainBundle] URLForResource:@"typo_tips" withExtension:@"pdf"];
    self.controller = [UIDocumentInteractionController interactionControllerWithURL:URL];
    self.controller.delegate = self;
    self.controller.UTI = @"com.adobe.pdf";
    
    [self.controller presentOpenInMenuFromRect:self.view.bounds inView:self.view animated:YES];
    }
    @end
    

    【讨论】:

    • 您好 pawanthanx 的回复...所以,在 @"ibooks://" 之后 // 我需要添加任何链接吗???
    • 您的 pdf 文件位于某个 url 或文档目录中?如果您在文档目录中有它,则获取文件的路径并添加到字符串 url。
    • 是的,我已经完成了,但它对我没有任何显示...我需要添加任何其他代码来显示 PDF 文件吗???
    • NSString *file = [[NSBundle mainBundle] pathForResource:@"typo_tips" ofType:@"pdf"]; NSString *stringURL = @"ibooks:/"; NSString *stringURL1 = [stringURL stringByAppendingString:file]; NSURL *url = [NSURL URLWithString:stringURL1]; [[UIApplication sharedApplication] openURL:url];
    • 检查修改后的代码。它是在 ios 中打开文档类型的正确方法(由苹果开发人员推荐)。
    猜你喜欢
    • 2011-02-03
    • 1970-01-01
    • 2012-03-28
    • 2019-04-30
    • 1970-01-01
    • 1970-01-01
    • 2019-10-15
    • 1970-01-01
    • 2018-08-16
    相关资源
    最近更新 更多