ios开发——加载PDF文件

来源:互联网 发布:淘宝该账号被限制登录 编辑:程序博客网 时间:2024/05/18 03:43

ios开发——加载PDF文件


方式一:

附图一

- (void)viewDidLoad

{
    [super viewDidLoad];
    //PDF 显示
    UIWebView *tempWV = [[UIWebView alloc] init];
    [tempWV setFrame:self.view.frame];
    [self.view addSubview:tempWV];
    
    [self loadDocument:@"用什么软件可以修改PDF文件" inView:tempWV];
}

-(void)loadDocument:(NSString *)documentName inView:(UIWebView *)webView
{
    NSString *path = [[NSBundle mainBundle] pathForResource:documentName ofType:@"pdf"];
    NSURL *url = [NSURL fileURLWithPath:path];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [webView loadRequest:request];

}

方式二:使用UIView的方式,读取本地的PDF文档

 demo下载地址:http://download.csdn.net/detail/u012881779/7266275




附图一:


0 0
原创粉丝点击