swift加載浏覽器
頁面上拉個控件
@IBOutlet weak var web: UIWebView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
var url = NSURL(string: http://www.111cn.net);
var request = NSURLRequest(URL: url!);
web.loadRequest(request);
}
純代碼實現
var webView = UIWebView()
webView.delegate = self
var url = NSURL(string:"http://localhost//list.php")
var urlRequest = NSURLRequest(URL:url!)
webView.frame = CGRectMake(0, 20, sizewebview, posywebview)
webView.loadRequest(urlRequest)
self.view.addSubview(webView)