滚动时自定义表格未正确显示 [英] Custom table is not shown properly when scrolled

查看:30
本文介绍了滚动时自定义表格未正确显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于某种原因,我的自定义表格单元在滚动时没有正确显示.我做错了什么吗?

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.

这篇关于滚动时自定义表格未正确显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆