关于 UIWebView 的说明
1、UIWebDocumentView
2、WebView
3、
//================================================================//
私有框架所在目录?
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/System/Library/PrivateFrameworks
//================================================================//
UIWebView 的层次
①、UIScrollView is a subview of UIWebView
②、UIWebDocumentView is a subview of UIScrollView
//================================================================//
如何获取 UIWebDocumentView 与 WebView ?
UIWebView *officialWebView = [[UIWebView alloc] init];
UIWebDocumentView *webDocumentView = nil;
id webView = nil;
webDocumentView = objc_msgSend(officialWebView, @selector(_documentView));
object_getInstanceVariable(webDocumentView, "_webView", (void**)&webView);
具体有支持哪些消息可以从网络上查找,有dump出的头文件供下载。
//================================================================//
如何截获 Touch 事件?
@implementation UIView (__TapHook)
- (void)__replacedTouchesBegan:(NSSet*)touches withEvent:(UIEvent*)event {
[self __replacedTouchesBegan:touches withEvent:event];
if( [self.superview.superview isMemberOfClass:[UICWebView class]] ) {
[(UICWebView*)self.superview.superview hookedTouchesBegan:touches withEvent:event];
}
}
@end
+ (void)installHook {
Class klass = objc_getClass( "UIWebDocumentView" );
// replace touch began event
method_exchangeImplementations(
class_getInstanceMethod(klass, @selector(touchesBegan:withEvent:)),
class_getInstanceMethod(klass, @selector(__replacedTouchesBegan:withEvent:)) );
}
ref:http://sonson-code.googlecode.com/svn/trunk/iPhone2.0/UICWebView/
//================================================================//
如何获取网页的真实加载速度?
①、注册通知:
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(progressEstimateChanged:)
name:WebViewProgressEstimateChangedNotification
object:coreWebView];
②、处理通知消息:
- (void)progressEstimateChanged:(NSNotification*)theNotification {
// You can get the progress as a float with
// [[theNotification object] estimatedProgress], and then you
// can set that to a UIProgressView if you'd like.
// theProgressView is just an example of what you could do.
[theProgressView setProgress:[[theNotification object] estimatedProgress]];
if ((int)[[theNotification object] estimatedProgress] == 1) {
theProgressView.hidden = TRUE;
// Hide the progress view. This is optional, but depending on where
// you put it, this may be a good idea.
// If you wanted to do this, you'd
// have to set theProgressView to visible in your
// webViewDidStartLoad delegate method,
// see Apple's UIWebView documentation.
}
}
ref:http://winxblog.com/2009/02/iphone-uiwebview-estimated-progress/
//================================================================//
调试 UIWebView
ref:http://www.idryman.org/blog/2012/06/17/debug-uiwebview-in-your-ios-app/
ref:http://atnan.com/blog/2011/11/17/enabling-remote-debugging-via-private-apis-in-mobile-safari/
//================================================================//
开启并使用 WebGL
ref:http://atnan.com/blog/2011/11/03/enabling-and-using-webgl-on-ios/
//================================================================//
关于 UIWebView 的说明的更多相关文章
- AFNetworking 3.0 源码解读(十一)之 UIButton/UIProgressView/UIWebView + AFNetworking
AFNetworking的源码解读马上就结束了,这一篇应该算是倒数第二篇,下一篇会是对AFNetworking中的技术点进行总结. 前言 上一篇我们总结了 UIActivityIndicatorVie ...
- ios UIWebView自定义Alert风格的弹框
之前开发过一个App,因为公司之前写好了网页版的内容和安卓版本的App,我进去后老板要求我ios直接用网页的内容,而不需要自己再搭建框架.我一听,偷笑了,这不就是一个UIWebView吗?简单! 但是 ...
- iOS网络3—UIWebView与WKWebView使用详解
一.整体介绍 UIWebView自iOS2就有,WKWebView从iOS8才有,毫无疑问WKWebView将逐步取代笨重的UIWebView.通过简单的测试即可发现UIWebView占用过多内存,且 ...
- IOS 网络浅析-(十二 UIWebView简介)
在这篇随笔里,我们只要知道UIWebView是什么就可以了. UIWebView 是苹果提供的用来展示网页的UI控件,它也是最占内存的控件. iOS8.0之后出现了webkit框架,WKWebView ...
- UIWebView获取网页点击事件
//接收web事件 -(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request nav ...
- IOS UIWebView 下拉刷新功能的简单实现
1.运行效果图 2.swift 代码的实现 import UIKit class RefreshWebViewController: UIViewController,UIScrollViewDele ...
- UI控件(UIWebView)
本文主要记录UIWebView三方面内容: 1.基本的加载网页链接或文件: 2.网页js调用原生,也就是Cordova混合架构的原理: 3.原生调用js程序: 原生部分主要代码: @implement ...
- UIwebView 和 H5交互详情
背景: 最近公司准备上一个只有原生登录界面 + H5网页 ,并且支持ios7.0 以上系统的混合app;这可把我难住了,原生的UI界面我可以正写反写各种style把界面搭建起来.而要这个app的难点在 ...
- ios UIWebView 在开发中加载文件
UIWebView 在实际应用中加载文件的时候,有两种情况, 1. 实行在线预览 , 2. 下载到本地,再查看 如果是第一种情况: NSURL *url = [NSURL URLWithString: ...
- iOS UIWebView 拦截点击事件(双击缩放)
在平时的开发中,要使用到webview,但类似微信的webview在数据没有加载完成的时候 双击屏幕,webview不会缩放,其实实现这个功能很简单 代码是用swift写的 class YYSimpl ...
随机推荐
- 【招聘App】—— React/Nodejs/MongoDB全栈项目:信息完善&用户列表
前言:最近在学习Redux+react+Router+Nodejs全栈开发高级课程,这里对实践过程作个记录,方便自己和大家翻阅.最终成果github地址:https://github.com/66We ...
- python——3.x的异常处理 请注意了
以前的python2.x的时候:try: fp=urllib.request.urlopen(blogurl) except Exception, e: print ...
- 微信小程序flex容器属性详解
flex容器属性详解 flex-direction决定元素的排列方向 flex-wrap决定元素如何换行 flex-flow 是 flex-direction 和flex-wrap的简写 justif ...
- js 根据身份证获取出生日期及性别
js根据身份证获取出生日期及性别 CreateTime--2017年6月2日11:45:16Author:Marydon 第一步:身份证号格式校验 /** * 身份证号格式校验 */ functi ...
- hibernate 继承映射关系( SINGLE_TABLE)
三种继承映射关系. 1,SINGLE_TABLE person student teacher 在一个表中,student和teacher继承自person,通过一个Discriminato ...
- Refactoring之——代码的坏味道(四)过长参数列
1.1.4 Long Parameter List(过长参数列) 特征:一个方法有超过三四个的参数. 问题原因: 过长参数列可能是将多个算法并到一个函数中时发生的.函数中的入参可以用来控制最终选用哪个 ...
- Jenkins部署java项目实例
源码管理 选择 “git”, Repository URL填写你的git地址,并配置对应的key,大家最好事前先在jenkins这台机器上能够直接远程git操作私有仓库 构建触发器.构建环境.Pre ...
- spring揭秘读书笔记----ioc的基本概念
在看ico概念之前,先想一下我们平常需要依赖某个类时会怎么做? 无非是在要用到的地方写如下代码: Person person = new Person(); //然后就可以用person对象来获取Pe ...
- C#中ArrayList类的使用
ArrayList类 使用大小可按须要动态添加的数组实现IList接口 命名空间:System.Collections 程序集:mscorlib 语法: public class ArrayList: ...
- 用nw.js开发markdown编辑器-已完成功能介绍
这里文章都是从个人的github博客直接复制过来的,排版可能有点乱. 原始地址 http://benq.im/2015/10/29/hexomd-introduction 文章目录 1. 功能列表 ...