how do I calculate heightForRowAtIndexPath when the cell is not even constructed yet?

前端 未结 2 1959
耶瑟儿~
耶瑟儿~ 2020-12-25 10:27

Question - How does one best calculate the height for a row in the \"heightForRowAtIndexPath\" method of a UITableViewController, given that:

  1. I\'m using a cust
2条回答
  •  甜味超标
    2020-12-25 10:52

    What I have done in the past, which I am not sure is the most efficient, is from within my heightForRowAtIndexPath method call cellForRowAtIndexPath then I ask the view for that cell its height. I have done similar things for header and footer heights. This way if I change the cell, the header, or the footer, I don't have to remember to go and update the corresponding height method.

提交回复
热议问题