我在 swift 应用程序中使用 UITableView,并使用我自己的自定义 UITableViewCell。
当尝试隐藏 UITableView 中的空单元格时,它仍然具有白色背景。
在 UITableView 下我有一个背景图像(UIimageView)。
我已经尝试隐藏这些单元格,实际上它们是隐藏的,但我仍然有白色背景,使用以下代码:
override func viewDidLoad() {
super.viewDidLoad()
var tblView = UIView(frame: CGRect(x: 0,y: 0,width: 0,height: 0))
tblView.backgroundColor = UIColor.clearColor()
tableView.tableFooterView = tblView
var nipName=UINib(nibName: "CustomCell", bundle:nil)
self.tableView.registerNib(nipName, forCellReuseIdentifier: "CustomCell")
}
更清洁的解决方案是:
tableView.tableFooterView = UIView(frame: CGRectZero)
不需要其他任何东西。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)