【发布时间】:2014-07-19 01:52:35
【问题描述】:
func tableView(tableView:UITableView!, numberOfRowsInSection section:Int) -> Int {
return 5
}
func tableView(tableView:UITableView!, cellForRowAtIndexPath indexPath:NSIndexPath!) -> UITableViewCell! {
let cell = tableView.dequeueReusableCellWithIdentifier("BookCell") as BookTableViewCell
println("ip: \(indexPath.row)")
cell.bookLabel.text = "Row #\(indexPath.row)"
return cell
}
我只看到一个单元格,文本被覆盖了 5 次,而不是 5 个单元格。我以为我们不必再做 if (!cell) 废话了?我做错了什么?
【问题讨论】:
-
工作正常,就像旧的好“废话”一样。
-
你搞砸了自动布局吗?
标签: ios uitableview swift xcode6