【发布时间】:2017-05-01 02:45:39
【问题描述】:
我有一个 tableView 有:
1-) 第 1 节标题
TableView Cell
2-) 第 2 节标题
Tableview Cell
3-) 第 3 节
(n rows that contains list of records)
我的 tableView 有 3 个部分。在第 3 节中,我列出了记录。当没有记录时,我会显示一个标签,上面写着“未找到记录”我的表格视图,如下图所示。
但我的问题是,我想将标签移动到 tableview 的底部(在“+”视图上)我该如何移动这个标签。这是我的快速代码
func setNoDataInfoIfAbsenceNotExists()
{
let noDataLabel : UILabel = UILabel()
noDataLabel.frame = CGRectMake(0, 0 , (self.tableView.bounds.width), (self.tableView.bounds.height))
noDataLabel.text = "No Records Found"
noDataLabel.textColor = UIColor.blackColor()
noDataLabel.textAlignment = .Center
self.tableView.backgroundView = noDataLabel
self.tableView.separatorStyle = .None
}
【问题讨论】:
-
你为什么不使用storyboard来改变约束???
-
在“+”视图上是什么意思?你的意思是制作+视图的标签子视图还是点击+你想移动标签???
-
nodataLabel.frame = (+View).frame 试试这个...