Swift how to design UIWebView Auto resize full screen in Story Board

I designed a UIWebView with 320×500 in StoryBoard.
But when run in Iphone 6 Plus Simulator, i want to this webview full screen or scale with the screen of device.
How to make it in storyboard?

I wrote code in ViewDidLoad but not working.

  • An error was encountered while running (Domain = LaunchServicesError, Code = 0)
  • How to make an enum conform to a protocol in Swift?
  • SpriteKit - Create at random position without overlapping
  • How can I use a protocol with a typealias as a func parameter?
  • UITextView contentOffset is set
  • swift 2.3 to swift 3.0
  • override func viewDidLoad() {
            super.viewDidLoad()
            self.detailWebView.frame = self.view.frame;
            println("H:\(self.view.frame.height), W:\(self.view.frame.width)")
            self.configureView()
        }
    

    Seem to be self.view.frame height and width that true, but size of this webview stills 320X500

    Solutions Collect From Internet About “Swift how to design UIWebView Auto resize full screen in Story Board”

    In ViewDidLoad and when you use autolayout, the frame is not yet calculated.
    So, place your code in viewDidLayoutSubviews or in viewDidAppear, and that should fix the bug.

    You can also fix that, only by adding constraints in your interface builder (do not forget to remove your code in viewDidLoad) :

    enter image description here