繁体   English   中英

如何使屏幕背景数据在 swift 中可见?

[英]How to make Screen Background Data visible in swift?

我想让屏幕如下所示。

在此处输入图像描述

在源代码 class 中,我编写此代码并推送到侧面菜单 controller。

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

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

我在目标 controller 视图中编写了以下代码,确实加载了方法,但只是颜色不透明度降低了数据不可见。

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

而不是使用.withAlphaComponent(0.4)

试试这个 根据需要调整数字

self.view.alpha = 0.5

你展示了你的 SideViewController。 也许自定义它的显示方式

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

在您的 SideViewController 中,

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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