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://baidu.com");
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)