- (void)viewDidLoad {
[super viewDidLoad];
//添加webView
UIWebView *webView = [[UIWebView alloc] initWithFrame:self.view.bounds];
webView.scalesPageToFit = YES;
[self.view addSubview:webView];
//获取文件路径
NSString *docPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
//拼接文件名
NSString *filePath = [docPath stringByAppendingPathComponent:@"b.doc"];
NSURL *url = [NSURL fileURLWithPath:filePath];
[webView loadRequest:[NSURLRequest requestWithURL:url]];
}
网友评论