iOS WKWebView Status Bar Padding

前端 未结 3 1546
执笔经年
执笔经年 2020-12-19 17:43

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 fanc

3条回答
  •  梦毁少年i
    2020-12-19 18:33

    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

提交回复
热议问题