Reputation: 1771
I am having this problem for the past two days and I'm trying to get my head around it with no good result.
I have a UITableView
with custom UITableViewCell
. Inside the UITableViewCell
I have a custom UIView
that I subclassed and drawing it by calling its own drawRect
.
The drawing for reused cells has no issues and the cell is calling its own drawRect
and the custom subview is calling its own drawRect
as well.
The problem arises when a new cell is dequeued, the custom subview drawRect
is not called at all leaving that view empty (non visible)
What I did:
subview.setNeedsDisplay
has no effect, it's redrawing the reused cells' custom subview but it has no affect on drawing the newer cells' custom subviews.That's the only thing I thought of and was obvious to try.
Is there a way to force drawing for the subviews for new UItableViewCell
?
Upvotes: 1
Views: 752
Reputation: 1771
I managed to solve the issue and force the redrawing of the subview of a custom cell by implementing heightForRowAtIndexPath
regardless of the iOS version (>=7)
Apparently iOS redraw the cell after the height is being calculated.
Upvotes: 0
Reputation: 2052
Have you tried calling [cell setNeedsDisplay]
but on the main thread?
Upvotes: 2