For example, there are 100 rows in tableView, heightForRowAtIndexPath: was executed already before the 100th row was show.
Why? In order to calculate contentSize of tableView?
Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
From Apple’s documentation :
So yes, it’s called prior to displaying the cell. If you think about it, if the table did it the other way around, it would create a cell with a standard height, put the content in it, get the real height, and resize/shift the cells. That would not be really nice.
This may cause performance issues, so you should only use it if you have cells of different heights :
Otherwise, if all your cells are the same height, use the
rowHeightproperty, and do not implementtableView:heightForRowAtIndexPath:.