Hi, I have a custom UITableViewCell with several labels of which the size needs to be calculated based on the content. Some of the content is also constructed on the fly, since I am generating an attributed string, and don't want to store these in my model objects.
The frame is calculated in heightForRowAtIndexPath: and layoutSubviews of my custom cell. The attributed string is calculated in heightForRowAtIndexPath: and cellForRowAtIndexPath: I put in some logs to see the order in which these methods are called, see below. Surprisingly (at least for me), heightForRowAtIndexPath is called for every row first, even the ones that are not yet visible. So when my data array is really large, this could take up some time, and I can see that when the table is drawn. There must be a more clever way to do this? - Koen. 2013-09-30 09:50:30.674 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.675 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.676 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.677 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.677 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.678 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.679 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.680 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.680 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.681 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.682 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.683 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.683 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.684 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.685 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.686 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.686 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.687 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.688 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.688 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.689 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.690 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.691 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.691 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.692 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.693 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.693 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.694 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.695 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.696 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.697 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.697 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.698 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.699 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.700 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.701 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.701 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.702 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.703 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.704 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.704 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.705 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.706 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.707 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.707 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.708 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.709 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.709 MyApp[23200:a0b] heightForRowAtIndexPath 2013-09-30 09:50:30.727 MyApp[23200:a0b] cellForRowAtIndexPath 2013-09-30 09:50:30.729 MyApp[23200:a0b] cellForRowAtIndexPath 2013-09-30 09:50:30.731 MyApp[23200:a0b] cellForRowAtIndexPath 2013-09-30 09:50:30.732 MyApp[23200:a0b] cellForRowAtIndexPath 2013-09-30 09:50:30.734 MyApp[23200:a0b] cellForRowAtIndexPath 2013-09-30 09:50:30.735 MyApp[23200:a0b] cellForRowAtIndexPath 2013-09-30 09:50:30.737 MyApp[23200:a0b] cellForRowAtIndexPath 2013-09-30 09:50:30.738 MyApp[23200:a0b] layoutsubviews 2013-09-30 09:50:30.739 MyApp[23200:a0b] layoutsubviews 2013-09-30 09:50:30.740 MyApp[23200:a0b] layoutsubviews 2013-09-30 09:50:30.741 MyApp[23200:a0b] layoutsubviews 2013-09-30 09:50:30.741 MyApp[23200:a0b] layoutsubviews 2013-09-30 09:50:30.742 MyApp[23200:a0b] layoutsubviews 2013-09-30 09:50:30.743 MyApp[23200:a0b] layoutsubviews 2013-09-30 09:50:30.754 MyApp[23200:a0b] layoutsubviews _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com