• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Efficient UITableViewCell usage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Efficient UITableViewCell usage


  • Subject: Re: Efficient UITableViewCell usage
  • From: Mike Abdullah <email@hidden>
  • Date: Mon, 30 Sep 2013 16:14:13 +0100

On 30 Sep 2013, at 15:47, Koen van der Drift <email@hidden> 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?

The table has to know how high each row is in order to know how tall it is in total. That information is needed for the scroll indicator.

I believe iOS 7 introduces the concept of an estimated height, allowing you to give it a quicker calculation, which later gets refined.


_______________________________________________

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


References: 
 >Efficient UITableViewCell usage (From: Koen van der Drift <email@hidden>)

  • Prev by Date: Efficient UITableViewCell usage
  • Next by Date: Re: Efficient UITableViewCell usage
  • Previous by thread: Efficient UITableViewCell usage
  • Next by thread: Re: Efficient UITableViewCell usage
  • Index(es):
    • Date
    • Thread