你好,歡迎來到IOS教程網

 Ios教程網 >> IOS編程開發 >> IOS開發綜合 >> iphone之打開pdf、doc、xls文件用UIWebView

iphone之打開pdf、doc、xls文件用UIWebView

編輯:IOS開發綜合
[cpp]  //文件名字及類型        NSString *path=[[NSBundle mainBundle]pathForResource:@"xls1" ofType:@"xls"];       //獲取內容        NSData *data = [[NSData alloc]initWithContentsOfFile:path];       NSString *string = [[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding];       NSLog(@"%@",string);              UIWebView *webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 55, 320, 300)];       webView.delegate = self;       webView.multipleTouchEnabled = YES;       webView.scalesPageToFit = YES;              NSURL *url = [NSURL fileURLWithPath:path];       NSURLRequest *request = [NSURLRequest requestWithURL:url];       [webView loadRequest:request];              [self.view addSubview:webView];     //文件名字及類型     NSString *path=[[NSBundle mainBundle]pathForResource:@"xls1" ofType:@"xls"];     //獲取內容 www.2cto.com     NSData *data = [[NSData alloc]initWithContentsOfFile:path];     NSString *string = [[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding];     NSLog(@"%@",string);          UIWebView *webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 55, 320, 300)];     webView.delegate = self;     webView.multipleTouchEnabled = YES;     webView.scalesPageToFit = YES;          NSURL *url = [NSURL fileURLWithPath:path];     NSURLRequest *request = [NSURLRequest requestWithURL:url];     [webView loadRequest:request];          [self.view addSubview:webView];  
  1. 上一頁:
  2. 下一頁:
蘋果刷機越獄教程| IOS教程問題解答| IOS技巧綜合| IOS7技巧| IOS8教程
Copyright © Ios教程網 All Rights Reserved