use*_*784 22 iphone uitableview ios swift
我在一个快速的应用程序中使用UITableView,并使用我自己的自定义UITableViewCell.
当试图隐藏UITableView中的空单元格时,它仍然具有白色背景.
在UITableView下我有一个背景图像(UImageView).
我已经尝试隐藏这些单元格,实际上它们是隐藏的,但我仍然有白色背景,使用此代码:
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")
}
Run Code Online (Sandbox Code Playgroud)
its*_*rof 31
更清洁的解决方案是:
tableView.tableFooterView = UIView(frame: CGRectZero)
Run Code Online (Sandbox Code Playgroud)
不需要任何其他东西.
use*_*784 25
这是解决方案:
tableView.tableFooterView = UIView(frame: CGRect(x: 0, y: 0, width: 0, height: 0))
tableView.tableFooterView?.isHidden = true
tableView.backgroundColor = UIColor.clear
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
11213 次 |
最近记录: |