zoukankan      html  css  js  c++  java
  • iOS 本地加载js文件

     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
  • 相关阅读:
    final有什么用?
    数组的定义
    作业
    List 、Set数据结构
    报表工具实现单据套打
    动态格报表的制作
    图形钻取
    报表工具轻松搞定卡片式报表
    列表钻取
    报表中如何实现不规则布局
  • 原文地址:https://www.cnblogs.com/lantu1989/p/4643834.html
Copyright © 2011-2022 走看看