How can initializing NSAttributedString in tableView:heightForRowAtIndexPath: be implicitly recursive?
Hard to say, but my guess is that the problem is #20. That seems to cause the code to reenter CFRunLoopRun
which then triggers queued table events that weren't supposed to run until after reloadData
was finished.
Suggested work-around: create your strings during initialization and store them in an NSArray
so that they can be retrieved when needed by heightForRowAtIndexPath
.
I've run into this same problem. It seems that initialising a NSAttributedString with html data runs an internal runloop while the html is being processed (by webkit, it seems..).
I've had a problem whereby setting an attributed string inside a table cell while it's scrolling sometimes causes a crash as the table continues scrolling before the attributed string has been initialised.
I solved it by constructing the NSAttributedString manually without using the html initialiser, as the formatting I was using wasn't too complicated.