简体   繁体   中英

Status bar overlapping

I trying to put constraint on my webview because its overlapping on the status bar.

I'm using Xcode 9.2.

When scrolling I don't want that the status bar go "translucent" or anything because its not readable I want a hard white but I cannot find the solution. I have put constraints but they don't seem to work.

Any ideas? I don't want to hide the status bar I want it not to be under my content.

重叠屏幕截图

故事板

[ Iphone截图

[ Iphone截图

//
//  FirstViewController.swift
//  Crossfit 514
//
//  Created by Admin on 2017-12-01.
//  Copyright © 2017 Crossfit 514. All rights reserved.
//

import UIKit
import WebKit
class FirstViewController: UIViewController, WKUIDelegate {

var webView: WKWebView!

@IBOutlet weak var constraint: WKWebView!
override func loadView() {
    let webConfiguration = WKWebViewConfiguration()
    webView = WKWebView(frame: .zero, configuration: webConfiguration)
    webView.uiDelegate = self
    view = webView
}
override func viewDidLoad() {
    super.viewDidLoad()

    let myURL = URL(string: "https://crossfit514.fliipapp.com/")
    let myRequest = URLRequest(url: myURL!)
    webView.load(myRequest)
}}

I think you must give top constraint to your webView as 20 from your superView and it won't overlap. (as I have understood your question)

您可以尝试在20个高度和屏幕的整个宽度的顶部添加一个空的UIView,然后相应地添加约束。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM