How can initializing NSAttributedString in tableView:heightForRowAtIndexPath: be implicitly recursive?

前端 未结 1 1342
深忆病人
深忆病人 2021-02-09 09:09

I am having a very strange problem when calculating the height of a UITableViewCell.

It seems like if I instantiate an NSAttributedString with

相关标签:
1条回答
  • 2021-02-09 09:37

    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.

    0 讨论(0)
提交回复
热议问题