Ganesh Kumar Ganesh Kumar - 1 year ago 101
iOS Question

IOS UIWebView is not loading the full website

i am learning iOS. i am trying to load a website in the UIWebView. The webpage is loading but the web view is not loading the full website. Instead the web view loads partial page of the website. Here is the code
what have i done wrong??

import UIKit

class ViewController: UIViewController {

@IBOutlet weak var webView: UIWebView!

override func viewDidLoad() {

// Do any additional setup after loading the view, typically from a nib.

override func viewWillAppear(animated: Bool) {
webView.frame = self.view.frame
let url = ""
let requestUrl = NSURL(string: url)
let request = NSURLRequest(URL: requestUrl!)
webView.scrollView.scrollEnabled = true

override func didReceiveMemoryWarning() {
// Dispose of any resources that can be recreated.

Answer Source

choice -1

 webView.scalesPageToFit = true

if it is not work try choice no -2

choice -2

 webView.frame = UIScreen.mainScreen().bounds =
 webView.scalesPageToFit = true

choice -3

 webView.frame =CGRectMake(0,0, self.view.frame.size.width , self.view.frame.size.height)


    webView.frame =CGRectMake(0, 0, UIScreen.mainScreen().bounds.width, UIScreen.mainScreen().bounds.height)

additional reference1, reference2

here I attached the sample project

the project output

enter image description here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download