zoukankan      html  css  js  c++  java
  • UIWebView

    #import <UIKit/UIKit.h>

     

    @interface ViewController : UIViewController<UIWebViewDelegate>

     

    @property (nonatomic, strong) UIWebView *webView;

     

    @end

     

     

    #import "ViewController.h"

     

    @interfaceViewController ()

     

    @end

     

    @implementation ViewController

     

    /* UIWebViewDelegate 协议的optional方法*/

    - (void)webViewDidStartLoad:(UIWebView *)webView{

        [[UIApplicationsharedApplication] setNetworkActivityIndicatorVisible:YES];

    }

    - (void)webViewDidFinishLoad:(UIWebView *)webView{

        [[UIApplicationsharedApplication] setNetworkActivityIndicatorVisible:NO]; }

    - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error{ [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];

    }

     

    - (void)viewDidLoad

    {

        [superviewDidLoad];

        self.webView = [[UIWebViewalloc] initWithFrame:self.view.bounds];

        self.webView.scalesPageToFit = YES;

        [self.view addSubview:self.webView];

        //NSString *htmlString = @"The first <strong>webView</strong>";

        NSURL *url = [NSURLURLWithString:@"http://www.apple.com"];

        NSURLRequest *request = [NSURLRequest requestWithURL:url];

        [self.webView loadRequest:request];

        //[self.webView loadHTMLString:htmlString baseURL:nil];

    //  UIWebView类的loading 方法:

    //    loadData:MIMEType:textEncodingName:baseURL:load an instance of NSData

    //    loadHTMLString:baseURL:load an instance of NSString,which the web browser can read.

    //    loadRequest:load an instance of NSURLRequest, help you to load the contents of a remote URL into a web.

    }

     

    - (void)didReceiveMemoryWarning

    {

        [superdidReceiveMemoryWarning];

    }

     

    @end

  • 相关阅读:
    一个简单的投票功能
    快速删除.svn文件夹
    屏蔽关键字
    批量过滤POST GET数据
    JS识别ios & 安卓
    HashMap
    GC
    类与类之间的关系
    玩转大数据之Apache Pig如何与Apache Lucene集成
    大话设计模式-简单工厂模式
  • 原文地址:https://www.cnblogs.com/liuhong/p/3291888.html
Copyright © 2011-2022 走看看