Re: IB keeps changing my constraints when I resize the cell
Re: IB keeps changing my constraints when I resize the cell
- Subject: Re: IB keeps changing my constraints when I resize the cell
- From: Rick Mann <email@hidden>
- Date: Sun, 16 Jun 2013 18:20:05 -0700
On Jun 15, 2013, at 20:00 , Quincey Morris <email@hidden> wrote:
> On Jun 15, 2013, at 19:31 , Rick Mann <email@hidden> wrote:
>
>> There's a setting for "Automatic"…where does it get it from then?
>
> AFAIK, it means the row height is set automatically based on the control size (small/medium/large).
Ah, I see. They should say "standard" height, then, perhaps.
>
>> Also, is there no way, using bindings, and no delegate, to choose among multiple NSTableViewCell implementations? I thought the 2011 WWDC video said it was possible, but I didn't quite understand what it was referring to. Unfortunately, there's no straightforward pure-bindings example to look at.
>
> There's no way within the design-time table view itself. If the table uses bindings and there's no delegate, the column identifier is used to choose the cell view to instantiate, which can be the design-time cell view or a view in its own registered nib, but can't be varied by row.
It seems that a property on the object could provide the identifier to use.
> If you want to choose between cell views by row, you need to put each cell view in its own nib, register each nib with the table view under a unique identifier, then implement the 'tableView/outlineView:viewFor…' delegate method to decide which identifier to use. It's very easy to do -- all it needs is to invoke 'makeViewWithIdentifier…' with a suitable identifier.
I can just put these in the table view, and instantiate them by identifier, right? They don't have to actually be in separate nibs, do they? That's not what I gleaned from the WWDC video.
> BTW, it can be much harder to vary the row height based on the cell view. You'd either need to cache all possible cell view heights in advance, or have a mechanism to calculate the cell view heights before view instantiation, or some combination of the two approaches.
Yeah. Typically on iOS I just get the cell for the row in the delegate and return its height. I had hoped there was a better mechanism in the context of bindings and autolayout. In the philosophy of autolayout, the cells should know their own height.
Anyway, I'll just implement the delegate method. Thanks!
--
Rick
_______________________________________________
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