zoukankan      html  css  js  c++  java
  • 关于 UIWebView 的说明

    本文转载至 http://blog.csdn.net/cyforce/article/details/8487856

    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/

    //================================================================//

     

  • 相关阅读:
    xampp只允许本地访问,禁止远程访问
    Centos 7 安装 设置 IP地址,DNS,主机名,防火墙,端口,SELinux (实测+笔记)
    centos 7.0 网卡配置及重命名教程
    VS2010 安装 MVC3 Entity Framework
    SQL 增加删除库表
    轻松绕各种WAF的POST注入、跨站防御(比如安全狗)
    CRM协同8.2升级到9.2SP2步骤
    [转]EasyUI+MVC+EF简单用户管理Demo(问题及解决)
    设置VMware随系统开机自动启动并引导虚拟机操作系统
    项目管理——随笔 2015.06.05
  • 原文地址:https://www.cnblogs.com/Camier-myNiuer/p/3522857.html
Copyright © 2011-2022 走看看