【发布时间】:2015-07-16 14:57:42
【问题描述】:
我不记得在我的场景中添加UITableViews 时看到这个额外的空间。这发生在我从 Interface Builder 的对象库中拖动默认对象时。
为了突出差距,我已将表格的背景颜色更改为灰色。
我使用以下代码在表格中填充数据。
extension UserListViewController: UITableViewDataSource {
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return users.count
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = UITableViewCell(style: .Subtitle, reuseIdentifier: nil)
cell.textLabel?.text = users[indexPath.row].name
return cell
}
}
我在视图控制器的viewDidLoad 中为轮廓设置了dataSource。
tableView.dataSource = self
那么这个差距从何而来?我该如何摆脱它?
【问题讨论】:
标签: ios swift uitableview