Re: Using table view cells from nibs
Re: Using table view cells from nibs
- Subject: Re: Using table view cells from nibs
- From: Luke Hiesterman <email@hidden>
- Date: Sat, 29 May 2010 08:56:55 -0700
I'm not sure why you're trying to separate the ideas of row and cell height. I don't think there's any reason why you should ever attempt to have a cell whose height is different from the height returned in heightForRowAtIndexPath. In fact, you shouldn't even be setting cell frames yourself. The table view does this for you based on the width of the table and the height the delegate returns.
To speak to the original poster, heightForRowAtIndexPath is THE way to set the height of your cells. If you expect a certain height when you design your cell in IB then you should make sure to return that height from your delegate.
Luke
Sent from my iPad
On May 29, 2010, at 1:32 AM, Quincey Morris <email@hidden> wrote:
> On May 28, 2010, at 23:39, Tino Rachui wrote:
>
>> I've created a table view cell in interface builder with a custom height. However when I load and use that kind of cell at runtime it disregards my custom height. I have to use 'heightForRowAtIndexPath' to set the desired cell height. Is there anything I'm missing?
>
> Well, the row height and the cell height are different things. The table view's built-in behavior places the cell at the top (AFAIK) of the row height.
>
> A custom cell can place itself at the vertical center (for example) of the row height, but that doesn't help you. You *need* to use 'heightForRowAtIndexPath' to make the rows tall enough for your custom cells. (Or, if possible, just set a larger row height in the table view in IB, if a single height works for all rows.)
>
>
> _______________________________________________
>
> 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
_______________________________________________
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