码迷,mamicode.com
首页 > Web开发 > 详细

UIWebView

时间:2014-12-05 10:44:37      阅读:146      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   io   ar   color   sp   on   2014   

//

//  WebViewController.swift

//  UIControlDemo

//

//  Created by on 14/12/3.

//  Copyright (c) 2014 马大哈. All rights reserved.

//

 

import UIKit

 

class WebViewController: BaseViewController ,UIWebViewDelegate{

    var web:UIWebView?

    override func viewDidLoad() {

        super.viewDidLoad()

        

        self.title = "WebView"

 

        web = UIWebView(frame: CGRectMake(0, 0, self.view.frame.size.width,self.view.frame.size.height))

        web?.backgroundColor = .whiteColor()

        web?.delegate = self

        web?.scalesPageToFit = true

        self.view.addSubview(web!)

        

        let stringUrl = "http://www.baidu.com"

        let url = NSURL(string: stringUrl)

        let urlRequest = NSURLRequest(URL: url!)

        web?.loadRequest(urlRequest)

 

    }

    

    func webView(webView: UIWebView, didFailLoadWithError error: NSError) {

        

        println("didFailLoadWithError")

        

    }

    

    func webView(webView: UIWebView, shouldStartLoadWithRequest request: NSURLRequest, navigationType: UIWebViewNavigationType) -> Bool {

        

        println("\(request)")

        

        return true

    }

    

    func webViewDidFinishLoad(webView: UIWebView) {

        println("webViewDidFinishLoad")

        

    }

    

    func webViewDidStartLoad(webView: UIWebView) {

        

        println("webViewDidStartLoad")

    }

    

    override func didReceiveMemoryWarning() {

        super.didReceiveMemoryWarning()

 

    }

 

}

 

bubuko.com,布布扣

UIWebView

标签:style   blog   http   io   ar   color   sp   on   2014   

原文地址:http://www.cnblogs.com/madaha/p/4145956.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!