美文网首页
TableViewCell添加UIView,点击消失问题

TableViewCell添加UIView,点击消失问题

作者: 木木小林酱 | 来源:发表于2016-02-25 00:33 被阅读113次

    在自定义TableViewCell的时候遇到这样一个问题,本想不使用TableView自带的separator,而是自己用UIView画出一条分隔线。

    结果在选中某行Cell的时候,这条分隔线就消失了,解决办法:

    重写-setSelected:animated:和-setHighlighted:animated:方法

    // 分隔线@property(nonatomic,weak)IBOutletUIView*separatorLine;// override- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated{    [supersetHighlighted:highlighted animated:animated];self.separatorLine.backgroundColor= [UIColorb lackColor];}- (void)setSelected:(BOOL)selected animated:(BOOL)animated{    [supersetSelected:selected animated:animated];self.separatorLine.backgroundColor= [UIColorblackColor];}

    相关文章

      网友评论

          本文标题:TableViewCell添加UIView,点击消失问题

          本文链接:https://www.haomeiwen.com/subject/hjpikttx.html