Mor*_*lde 3 uitableview ios swift
我不记得在UITableView
为场景添加s 时看到这个额外的空间.当我从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
}
}
Run Code Online (Sandbox Code Playgroud)
dataSource
我viewDidLoad
在视图控制器的内部设置了轮廓.
tableView.dataSource = self
Run Code Online (Sandbox Code Playgroud)
那么这个差距来自哪里呢?我怎么摆脱它呢?
您可以尝试在控制器中设置它:
self.automaticallyAdjustsScrollViewInsets = false
Run Code Online (Sandbox Code Playgroud)
这个属性非常自我解释.在iOS 7中,Apple推出了半透明顶杆.通常他们希望您的UITableview从顶部开始,就像顶部栏后面的某些部分一样.在这种情况下,在顶部具有自动插入以使内容可见是有用的.
归档时间: |
|
查看次数: |
4219 次 |
最近记录: |