Code Monkey home page Code Monkey logo

zlcwebview's Introduction

[TOC]


将UIWebVIew和WKWebView封装到一起,当系统版本大于8.0时候选择WKWebView降低性能消耗,当小于8.0时候使用UIWebView进行加载

____ ios 8.0以上使用ZLCWebView 加载“http://www.baidu.com” ____

zlcwebview.png

____ ios 8.0以上使用UIWebView 加载“http://www.baidu.com” ____

uiwebview.png

1、将项目中的根目录中的“ZLCWebView源文件”中的ZLCWebView.h及m拖入工程(或直接在项目中拖出)
2、在项目Targets ->build Phases ->link Binary With Libraries 中添加WebKit.framework(否则Deployment Target调整成7.0时,运行程序就会报错)
3、在自己的目标视图加载即可
//在目标视图内初始化ZLCWebView 
ZLCWebView *my = [[ZLCWebView alloc]initWithFrame:self.view.bounds];
   [my loadURLString:@"http://www.baidu.com"];
my.delegate = self;
[self.view addSubview:my];

//让视图遵守ZLCWebView的delegate并实现ZLCWebView的delegate

- (void)zlcwebViewDidStartLoad:(ZLCWebView *)webview
{
NSLog(@"页面开始加载");
}

- (void)zlcwebView:(ZLCWebView *)webview shouldStartLoadWithURL:(NSURL *)URL
{
NSLog(@"截取到URL:%@",URL);
}
- (void)zlcwebView:(ZLCWebView *)webview didFinishLoadingURL:(NSURL *)URL
{
NSLog(@"页面加载完成");
   
}

- (void)zlcwebView:(ZLCWebView *)webview didFailToLoadURL:(NSURL *)URL error:(NSError *)error
{
NSLog(@"加载出现错误");
}

zlcwebview's People

Contributors

lczhai avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.