![](/img/trans.png)
[英]iOS change font of content in UIWebView after full loading by javascript
[英]IOS UIWebView is not loading the full website
我正在學習iOS。 我正在嘗試在 UIWebView 中加載一個網站。 網頁正在加載,但網絡視圖未加載完整的網站。 相反,網絡視圖加載網站的部分頁面。 這是我做錯了什么的代碼?
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var webView: UIWebView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
webView.frame = self.view.frame
let url = "http://www.tradiestart.com.au"
let requestUrl = NSURL(string: url)
let request = NSURLRequest(URL: requestUrl!)
webView.loadRequest(request)
webView.scrollView.scrollEnabled = true
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
選擇-1
webView.scalesPageToFit = true
如果它不起作用,請嘗試選擇 no -2
選擇-2
webView.frame = UIScreen.mainScreen().bounds
webView.center = self.view.center
webView.scalesPageToFit = true
選擇-3
webView.frame =CGRectMake(0,0, self.view.frame.size.width , self.view.frame.size.height)
or
webView.frame =CGRectMake(0, 0, UIScreen.mainScreen().bounds.width, UIScreen.mainScreen().bounds.height)
在這里我附上了示例項目
項目輸出
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.