bogardon
bogardon

Reputation: 915

UITableView separators disappears?

in my uitableview, i subclassed uitableviewcell's, and i added a subview to the contentview with flexible width and height. the cells are of dynamic height.

when the tableview first loads, everything is fine. however, as i start to scroll around, separators start disappearing, and they happen at the same places every launch. scrolling around some more will recover the lost separators.

anyone else encounter this?

Upvotes: 1

Views: 3085

Answers (2)

bogardon
bogardon

Reputation: 915

The problem was related to the dynamic heights. Using either ceilf or floorf solved the problem.

Upvotes: 3

pottedmeat
pottedmeat

Reputation: 3421

I don't know how specific this will be to your project, but I'll tell you what I figured out. Overriding my layoutSubviews method was the problem. I looked at the view hierarchy of my cell before and after I called [super layoutSubviews] and discovered that this method was making the contentView 1 pixel shorter and added a new view below it 1 pixel high with a background color of 0.88/0.88/0.88.

If you can't live with some of the side effects of the superclass implementation, it looks like this view must be added manually.

Upvotes: 6

Related Questions