1 #import "RootViewController.h"
 2 
 3 @interface RootViewController ()<UIWebViewDelegate>
 4 
 5 @property (nonatomic, strong)UIWebView *webView;
 6 
 7 @end
 8 
 9 @implementation RootViewController
10 
11 - (void)dealloc
12 {
13     self.webView = nil;
14 }
15 - (void)viewDidLoad {
16     [super viewDidLoad];
17     self.view.backgroundColor = [UIColor redColor];
18     self.webView = [[UIWebView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
19     [self.view addSubview:self.webView];
20     // cli_dwr.html文件名
21     [self loadDocument:@"cli_dwr.html"];
22 }
23 // 加载本地使用说明文件
24 - (void)loadDocument:(NSString *)docName
25 {
26     NSString *mainBundleDirectory = [[NSBundle mainBundle] bundlePath];
27     NSString *path = [mainBundleDirectory stringByAppendingPathComponent:docName];
28     
29     NSURL *url = [NSURL fileURLWithPath:path];
30     NSURLRequest *request = [NSURLRequest requestWithURL:url];
31     self.webView.scalesPageToFit = YES;
32     [self.webView loadRequest:request];
33 }
34 
35 @end

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-19
  • 2021-11-20
  • 2021-12-17
  • 2021-12-19
猜你喜欢
  • 2021-11-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-18
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案