gpt4 book ai didi

ios - 设置uitableview背景 View

转载 作者:行者123 更新时间:2023-11-28 12:23:08 25 4
gpt4 key购买 nike

我想为我的tableview设置背景 View ,

 override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)

let backgroundView = BackgroundGradient(frame: self.view.frame)
self.tableView.backgroundView = backgroundView
}

但是背景仍然是白色(应该是蓝色渐变)。我试图在 View 中设置它并加载,结果相同,我更改为背景颜色以清除,但仍然没有。我错过了什么?

最佳答案

您的 UITableViewCell 可能会遮挡您表格的 backgroundView。尝试将单元格的背景颜色设置为清除。

引自 Apple 文档 (https://developer.apple.com/reference/uikit/uitableview/1614986-backgroundview)

You must set this property to nil to set the background color of the table view.

关于ios - 设置uitableview背景 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44216329/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com