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)
时间: 2024-09-28 06:08:12