UITableView Separator出现在单元格视图的中间 [英] UITableView Separator appears in middle of Cell's View

查看:53
本文介绍了UITableView Separator出现在单元格视图的中间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用默认的iOS 7的TableView分隔符.我有不同高度的自定义单元格.频繁上下滚动时,一些较小的单元格会留在分隔符后面(也许不确定这是否是原因).因此,大多数情况下,较大的单元格会在中间被分隔符切断.

I am using default iOS 7's TableView Separator. I have custom cells of varying height. When scrolled up and down frequently some of the smaller cells leave behind their separators(perhaps, not sure if this is the cause). So the bigger cell gets cut right in the middle most of the times by the separator.

我尝试将单元格的边缘插图重置为它们的先前位置,但似乎不起作用

I have tried resetting cell's edge insets to their previous location but it does not seem to work

-(void)prepareForReuse
{
    [self setSeparatorInset:UIEdgeInsetsZero];
}

推荐答案

好吧,如果您将UITableViewCell子类化并覆盖 layoutSubviews ,那么请确保您调用 super.layoutSubviews()在功能主体的顶部.

Well, if you subclass UITableViewCell and override layoutSubviews, then make sure you call super.layoutSubviews() at the top of your function body.

快速

override func layoutSubviews() {
    super.layoutSubviews()

    // do any customization here...
}

这篇关于UITableView Separator出现在单元格视图的中间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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