iphoneobjective-ciosuitableviewsetneedsdisplay

Confusion about UIView's setNeedsDisplay


I have an ivar of UITableView* myTableView. I have data being loaded from internet so when the data gets loaded should i call [myTableView setNeedsDisplay], i know i can/should call [myTableView reloadData] but the confusion is that calling setNeedsDisplay should also work but is not working.

I am just looking for an explanation as to what setNeedsDisplay does? when called on UITableView instance.

As per the documentation setNeedsDisplay calls drawRect in "next drawing cycle". so can anyone tell me what is the next drawing cycle.


Solution

  • setNeedsDisplay marks the calling UIView as needing to be redrawn is a purely visual sense, which as stated will happen on the next drawing cycle.

    This is completely different to reloading the data when used in a UITableView context.

    See this article for a little more information on the subject.