• 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: UILabel's sizeToFit - only on re-used cells
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: UILabel's sizeToFit - only on re-used cells


  • Subject: Re: UILabel's sizeToFit - only on re-used cells
  • From: Torsten Curdt <email@hidden>
  • Date: Wed, 15 Jan 2014 14:22:44 +0100

>
> The size of the cell you get from dequeueReusableCellWithIdentifier is
> meaningless until the cell gets added to the table view, which doesn’t
> happen until you return the cell from the delegate method you’re in.
>

Not sure I understand why the cell size matters though. All views/labels
have a size given through IB. With also the font size given - I find it a
bit odd that 'sizeToFit' does not work correctly in
'tableView:cellForRowAtIndexPath:'

So do you always just create the cell in tableView:cellForRowAtIndexPath:
and then to do filling and styling in
‘tableView:willDisplayCell:forRowAtIndexPath:' ?


> One solution is to manually resize the cell (you probably care only about
> the width?) before returning it. Another is to resize the label later,
> after the cell is added to the table. (IIRC, the delegate method
> ‘tableView:willDisplayCell:forRowAtIndexPath:; was where I did it.) Yet
> another is to use auto layout to resize the label.
>

Indeed that fixes it. Amazing.

cheers,
Torsten
_______________________________________________

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: 
 >UILabel's sizeToFit - only on re-used cells (From: Torsten Curdt <email@hidden>)
 >Re: UILabel's sizeToFit - only on re-used cells (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: Drag a window and get draggingEntered
  • Next by Date: What are the conditions for NSManagedObjectContextObjectsDidChangeNotification to get posted?
  • Previous by thread: Re: UILabel's sizeToFit - only on re-used cells
  • Next by thread: Re: UILabel's sizeToFit - only on re-used cells
  • Index(es):
    • Date
    • Thread