简体   繁体   中英

How to remove the transparency of top Bar on IOS App swift

I have a Web View app. Main Problem I am facing is when I scroll the page, Content is visible on top bar where Battery, Signal and time is mentioned. 在此处输入图片说明

This is really weird.

在此处输入图片说明

What I have done but not getting the luck

info.plist ->
add row -> View Controller-based-status bar appearance -> Set NO

Also tried many things but not getting success. Is there anyone who can guide me hoe to solve this.

Any help or suggestion is really appreciated.

QUESTION UPDATE:

I added on ViewController.swift under loadView Function:

let containerViewHeight: CGFloat = 45

webView = WKWebView()//(frame: CGRect(x:0, y: 0, width:screenWidth, height:screenHeight))
view.addSubview(webView)

webView.translatesAutoresizingMaskIntoConstraints = false
webView.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 0.0).isActive = true
webView.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: 0.0).isActive = true
webView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 0.0).isActive = true
webView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -containerViewHeight).isActive = true

containerView = WKWebView()//(frame: CGRect(x:0, y: 0, width:screenWidth, height:screenHeight))
view.addSubview(containerView)

containerView.translatesAutoresizingMaskIntoConstraints = false
containerView.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 0.0).isActive = true
containerView.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: 0.0).isActive = true
containerView.topAnchor.constraint(equalTo: webView.bottomAnchor, constant: 0.0).isActive = true
containerView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: 0.0).isActive = true

By this My issue will Resolved. But on footer bar there is a space created. I attached the image for reference.

在此处输入图片说明

Can Anyone guide me how to resolve this?

Like below image select your web view in storyboard. then add these 4 constraints to 0. then press “Add 4 constraints”

在此处输入图片说明

For more about autolayout: Auto layout tutorial

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