iOS 7.1 UitableviewCell content overlaps with ones below

前端 未结 7 1774
执念已碎
执念已碎 2020-12-08 07:11

So I have code, which is sucessfully working on iOS 7.0 but not in 7.1. I have a simple tableview, with code:

- (NSInteger)numberOfSectionsInTableView:(UITab         


        
相关标签:
7条回答
  • 2020-12-08 08:01

    The issue has to do with the height of your cell. It isn't going to dynamically adjust that for you.

    You'll probably notice that as you scroll and the view above goes out of view the overlapping text will disappear with it.

    If you are wanting your text to clip at a certain height, then you need to set the number of lines, rather than setting it to 0 since that will let it continue forever.

    The lineBreakMode won't take effect since it isn't stopped.

    Optionally you could try to set clipping on the contentView to make sure all subviews stay inside.

    Depending on the end result you want, you could do dynamic heights and change based on the content. There are a bunch of SO questions related to doing this.

    Update - clipping the contentView

    I'd have to try it out myself, but in lieu of that, here are a couple links related to clipping the contentView:

    • stop the clipping of contentView - you'd actually want to do the opposite.
    • adding subview - looks similar to what you are trying to do.

    Looks like this works:

    cell.clipsToBounds = YES;
    
    0 讨论(0)
提交回复
热议问题