滚动时自定义表格未正确显示
问题描述:
由于某种原因,我的自定义表格单元在滚动时没有正确显示.我做错了什么吗?
For some reason my custom table cell is not shown properly when scrolled. Anything I am doing wrong?
这是我的代码:
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("RestaurantCell", forIndexPath: indexPath) as! RestaurantCell
cell.name?.text = "Some test value"
return cell
}
这是它的外观:
答
可能您在用于单元格的故事板/xib 中存在约束问题.
Probably you have constraint issues in the storyboard/xib you're using for the cells.