iOS WKWebView Status Bar Padding

Viewed 8440

I have been endlessly searching for an answer for this that works. I am trying to create a very simple WKWebView application to wrap out web app. I don't need anything fancy as navigation controls are all within the application.

Currently my ViewController.swift file looks like this:

https://gist.github.com/andrewweaver/4a0e13245f185e8f31ba812b91f7dddd

Swift version: Apple Swift version 3.1 (swiftlang-802.0.53 clang-802.0.42)

The issue is the padding for the status bar, I would like to adjust it so that the status bar wasn't on top of the content as it is here:

enter image description here

Any help would be greatly appreciated as I am very new to iOS development. I would also like to be able to change the status bar color, but it isn't an immediate concern at this time.

3 Answers
let screenWidth = UIScreen.main.bounds.width
let screenHeight = UIScreen.main.bounds.height

self.webView = WKWebView(frame:CGRect( x: 0, y:UIApplication.shared.statusBarFrame.size.height, width:screenWidth, height: screenHeight ), configuration: WKWebViewConfiguration() )

make sure to import UIKit. compatible to all the devices no status bar issues

Related