Adam Adam - 28 days ago 6x
Swift Question

Xcode WebApp - Not Centered when launched on iPhone/Safari

I'm doing my first Xcode WebApp - below is the View Controller:

// ViewController.swift
// iOS8SwiftWebViewTutorial
// Created by Administrator on 26/09/2016.
// Copyright © 2016 Administrator. All rights reserved.

import UIKit

class ViewController: UIViewController {

let url = ""

override func viewDidLoad() {

let requestURL = NSURL(string:url)
let request = NSURLRequest(URL: requestURL!)

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

@IBOutlet weak var webView: UIWebView!


It launches on the Simulator and my physical iphone.

The only issue is what ever site I put into the code - even sites like I find its not centered.

enter image description here

Thanks-you :)


if the webView should fill the screen then you can use:

webView.frame = self.view.frame

place that in your viewDidLoad method.