Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.
You could always test it yourself using some NSLog statements. But, as Domele stated you shouldn't rely on undocumented behavior. It could change without notice.
Apple does not state the order in their documentation so you shouldn't make your code reliant on the order.
What are you trying to accomplish?
Dear Domele,
In cellForRowAtIndexPath I want to set the content of the table view cell
And later that, I want to set the height of the row based on the content of table view cell, so I want to guarantee that heightForRow be called after cellForRowAtIndexPath
Well you can't guarantee the order call so you'll need to find a way to compute the height before actually inputting the data into your views. You can compute the size of strings using methods found here: Loading
If you are looking for a quality developer, I'm your man. Give me a PM if you are interested.
Well you can't guarantee the order call so you'll need to find a way to compute the height before actually inputting the data into your views. You can compute the size of strings using methods found here: Loading
Dear Domele,
But until to cellForRowAtIndexPath I know the content of the cell.
I want to set the height of the row based on the content of table view cell, so I want to guarantee that heightForRow be called after cellForRowAtIndexPath
So call cellForRowAtIndexPath within your heightForRow implementation.
No, no, no. That would mean the UITableView would have to allocate cells for however many rows he has with no reusing or caching whatsoever. UITableView (I assume) uses heightForRow to calculate the total height of the table so that it can set up scroll bars and such. This means, heightForRow will be called for every row in the table when it is added to a view for the first time or reloadData is called.
If you are looking for a quality developer, I'm your man. Give me a PM if you are interested.
Re. Domele - that makes sense. I wasn't thinking about the work involved in allocating cells. I wouldn't say that I would have used the approach I suggested in my own code, but it seemed like the easy way to do what the OP wanted.
My main discomfort with the whole issue here is that it seems to violate MVC. I think that's what others are hinting at, and it's definitely what I would do if it were my code.
Replies
What are you trying to accomplish?
New app - See screenshots and details at www.globaclock.com.
If you want to
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeSome of my code can be found on GitHub.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeIn
cellForRowAtIndexPath
I want to set the content of the table view cell
And later that,
I want to set the height of the row based on the content of table view cell, so I want to guarantee that heightForRow be called after cellForRowAtIndexPath
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeNew app - See screenshots and details at www.globaclock.com.
If you want to
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeBut until to cellForRowAtIndexPath I know the content of the cell.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeNew app - See screenshots and details at www.globaclock.com.
If you want to
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeNew app - See screenshots and details at www.globaclock.com.
If you want to
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeSlickShopper 2 | BTIConcepts on GitHub | Free NSLog utility | Free Getter Utility | Leave a PayPal donation.
Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | A Model (Object) Is A Beautiful Thing
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeMy main discomfort with the whole issue here is that it seems to violate MVC. I think that's what others are hinting at, and it's definitely what I would do if it were my code.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome