Re: Efficient UITableViewCell usage
Re: Efficient UITableViewCell usage
- Subject: Re: Efficient UITableViewCell usage
- From: Michael Starke <email@hidden>
- Date: Mon, 30 Sep 2013 17:51:00 +0200
Just a small note: The height is called for all the data to determine
the scroller size.
On 30.09.2013 16:47, Koen van der Drift wrote:
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 (email@hidden)
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:
This email sent to email@hidden
--
___m i c h a e l s t a r k e____
geschäftsführer
HicknHack Software GmbH
www.hicknhack-software.com
___k o n t a k t____
+49 (170) 3686136
email@hidden
___H i c k n H a c k S o f t w a r e G m b H____
geschäftsführer - maik lathan | andreas reischuck | michael starke
bayreuther straße 32
01187 dresden
amtsgericht dresden HRB 30351
sitz - dresden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden