构建一个方法用来载入网页的请求:
func loadurl(url:String ,web:UIWebView){ let aurl = NSURL(string: url) let urlrq = NSURLRequest(URL: aurl!) web.loadRequest(urlrq) }
@IBOutlet weak var loading: UIActivityIndicatorView!
//网页开始载入 func webViewDidStartLoad(webView: UIWebView) { loading.startAnimating() } //网页结束载入 func webViewDidFinishLoad(webView: UIWebView) { loading.stopAnimating() }
//网页开始载入 func webViewDidStartLoad(webView: UIWebView) { loading.startAnimating() UIApplication.sharedApplication().networkActivityIndicatorVisible = true } //网页结束载入 func webViewDidFinishLoad(webView: UIWebView) { loading.stopAnimating() UIApplication.sharedApplication().networkActivityIndicatorVisible = false }
原文地址:http://blog.csdn.net/cg1991130/article/details/43992095