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

  • 相关阅读:
    MSSQL经典语句
    注销时关闭当前窗体,返回登入界面
    自定义控件小结进阶篇
    精妙SQL语句大全
    触发器MSSQL常用操作
    经典SQL语句大全
    文件下载
    android Notification 的使用
    startActivityForResult()的用法
    Android手机中获取手机号码和运营商信息
  • 原文地址:https://www.cnblogs.com/liuhong/p/3291888.html
Copyright © 2011-2022 走看看