简体   繁体   中英

How to make Screen Background Data visible in swift?

I want to make the screen like the following.

在此处输入图像描述

In source class, I write this code and push to side menu controller.

let vc = self.storyboard?.instantiateViewController(withIdentifier: "SidemenuController")as! SidemenuController

self.navigationController?.pushViewController(vc, animated: false)

I write the following code in destination controller view did load method but just color opacity is decreased data is not visible.

override func viewDidLoad() {
    self.view.backgroundColor = self.hexStringToUIColor(hex: "BE8790").withAlphaComponent(0.4)
}

Instead of using .withAlphaComponent(0.4)

Try this Adjust the number as needed

self.view.alpha = 0.5

You show present your SideViewController. Maybe custom how it shows

 let sideVC = // Your init
 sideVC.modalPresentationStyle = .fullScreen
 present(sideVC, animated: true, completion: nil)

In your SideViewController,

override func viewDidLoad() {
        super.viewDidLoad()
        view.alpha = 0.5
        view.backgroundColor = // Your color
        tableView.backgroundColor = .clear
}

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