// // FileOpenViewController.m // smartRhino // // Created by niuzhen on 2020/2/14. // Copyright © 2020 tederen. All rights reserved. // #import "FileOpenViewController.h" @interface FileOpenViewController () @property (weak, nonatomic) IBOutlet UILabel *titleL; @property (strong, nonatomic) WKWebView *webView; @end @implementation FileOpenViewController + (FileOpenViewController *)initFileOpenViewController{ FileOpenViewController *controller = [StoryboardManager.shared.myTDTopic instantiateViewControllerWithIdentifier:@"FileOpenViewController"]; return controller; } - (void)viewDidLoad { [super viewDidLoad]; self.titleL.text = @"打开"; self.webView = [[WKWebView alloc] init]; [self.view addSubview:self.webView]; [self.webView mas_makeConstraints:^(MASConstraintMaker *make) { make.edges.mas_offset(UIEdgeInsetsZero); }]; NSString *path = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"pdf"];//需要在线预览的文件 NSURL *pathUrl = [NSURL URLWithString:path]; //加载 NSURLRequest *request = [NSURLRequest requestWithURL:pathUrl]; [self.webView loadRequest:request]; } @end