zoukankan      html  css  js  c++  java
  • 关于 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/

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

  • 相关阅读:
    1,300萬像素Xperia TX K.O.相機 東方日報
    信息检索Reading List
    雷军:小米二为何不用1300万像素相机_TechWeb
    1300万像素高清双核旗舰 索尼LT30p评测_手机_科技时代_新浪网
    Darts: DoubleARray Trie System海 的 声音我的搜狐
    说说底层架构之实体类的设计
    不忘本~枚举
    两种底层数据层操作时的架构方式,你喜欢那种?
    说说C#中的global
    JS对外部文件的加载及对IFRMAME的加载的实现,当加载完成后,指定指向方法(方法回调)
  • 原文地址:https://www.cnblogs.com/Proteas/p/2720687.html
Copyright © 2011-2022 走看看