ios - webpage in webView fill issue swift 3 -
i have webview in view controller constraints (second controller):
my problem when show page , webpage doesn't fill whole webpage view , there (bottom , up) white space this:
i set controller there webpageview in way:
class xviewcontroller: uiviewcontroller , uiwebviewdelegate { @iboutlet var webv : uiwebview! var url = "" var reloadicon : uirefreshcontrol? override func viewdidload() { super.viewdidload() self.reloadicon = uirefreshcontrol(frame: cgrect(x: uiscreen.main.bounds.width-20, y: 20, width: 40, height: 40)) //self.webv = uiwebview(frame: cgrect( x: 0, y:0, width : uiscreen.main.bounds.width, height : uiscreen.main.bounds.height - 44)) self.webv.scalespagetofit = true self.webv.contentmode = .scaletofill self.webv.isopaque = false self.webv.backgroundcolor = uicolor.clear self.webv.delegate = self } override func viewwillappear(_ animated: bool) { super.viewwillappear(animated) self.webv.ishidden = true self.webv.loadrequest(nsurlrequest(url: nsurl(string: self.url)! url) urlrequest) } func resfreshwebview(){ self.webv.ishidden = true webv?.reload(); } func webviewdidfinishload(_ webview: uiwebview){ } func webview(_ webview: uiwebview, didfailloadwitherror error: error) { } func webviewdidstartload(_ webview: uiwebview){ self.webv.ishidden = false } }
p.s noted in storyboard there 2 bar ( black , grey) , don't understand why.
my first thought try self.automaticallyadjustsscrollviewinsets = false
Comments
Post a Comment