zoukankan      html  css  js  c++  java
  • UIWebView头文件研读

    //
    //  UIWebView.h
    //  UIKit
    //
    //  Copyright (c) 2007-2011, Apple Inc. All rights reserved.
    //

    typedef enum {
        UIWebViewNavigationTypeLinkClicked,  //链接类型,html中的超级链接
        UIWebViewNavigationTypeFormSubmitted, //html表单提交
        UIWebViewNavigationTypeBackForward,  //html 触发返回操作
        UIWebViewNavigationTypeReload,    //html 刷新当前页
        UIWebViewNavigationTypeFormResubmitted, //html 表单再提交
        UIWebViewNavigationTypeOther  //其他
    } UIWebViewNavigationType;  //点击webview中的某些事件时的类型,js控制本地函数

    @class UIWebViewInternal;
    @protocol UIWebViewDelegate;

    UIKIT_CLASS_AVAILABLE(2_0) @interface UIWebView : UIView {
     @private
        UIWebViewInternal *_internal;
    }

    @property(nonatomic,assign) id delegate;

    @property(nonatomic,readonly,retain) UIScrollView *scrollView __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_5_0);

    //加载web内容 有三种方式
    - (void)loadRequest:(NSURLRequest *)request;
    - (void)loadHTMLString:(NSString *)string baseURL:(NSURL *)baseURL;
    - (void)loadData:(NSData *)data MIMEType:(NSString *)MIMEType textEncodingName:(NSString *)textEncodingName baseURL:(NSURL *)baseURL;

    @property(nonatomic,readonly,retain) NSURLRequest *request;

    - (void)reload;
    - (void)stopLoading;

    - (void)goBack;
    - (void)goForward;

    @property(nonatomic,readonly,getter=canGoBack) BOOL canGoBack;
    @property(nonatomic,readonly,getter=canGoForward) BOOL canGoForward;
    @property(nonatomic,readonly,getter=isLoading) BOOL loading;

    //在webview中操作html网页
    - (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script;

    @property(nonatomic) BOOL scalesPageToFit;

    @property(nonatomic) BOOL detectsPhoneNumbers __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA, __MAC_NA, __IPHONE_2_0, __IPHONE_3_0);
    @property(nonatomic) UIDataDetectorTypes dataDetectorTypes __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_3_0);

    @property (nonatomic) BOOL allowsInlineMediaPlayback __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_4_0); // iPhone Safari defaults to NO. iPad Safari defaults to YES
    @property (nonatomic) BOOL mediaPlaybackRequiresUserAction __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_4_0); // iPhone and iPad Safari both default to YES

    @property (nonatomic) BOOL mediaPlaybackAllowsAirPlay __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_5_0); // iPhone and iPad Safari both default to YES

    @end

    @protocol UIWebViewDelegate

    @optional
    //在js中操作webview中的object-c方法  如果获取设备信息  调摄像头等 web内容将要开始请求
    - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType;
    //web内容已开始加载的回调
    - (void)webViewDidStartLoad:(UIWebView *)webView;
    //web内容已经加载完毕的回调
    - (void)webViewDidFinishLoad:(UIWebView *)webView;
    //web内容加载失败的回调
    - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error;

    @end

  • 相关阅读:
    Educational CF # 17 C 二分,字符串 D 最长路,dp
    HDU-1878 判断无向图欧拉回路,水
    LightOJ-1094 求树直径,水
    POJ-1144 Tarjan求割点,双连通模板题
    HDU-1269 Tarjan求强连通分量,模板题
    POJ-1094 拓扑排序
    POJ-1847 最短路裸题,Floyd, Bellman, Dijkstra, Spfa
    LightOJ-1005 组合数学,组合数水题
    CF #392(2) C 暴力模拟
    Android xUtils3使用
  • 原文地址:https://www.cnblogs.com/cnsec/p/11515848.html
Copyright © 2011-2022 走看看