Re: split views, best practices for 10.8?
Re: split views, best practices for 10.8?
- Subject: Re: split views, best practices for 10.8?
- From: Peter Ammon <email@hidden>
- Date: Thu, 13 Dec 2012 11:57:30 -0800
On Dec 12, 2012, at 4:20 PM, Chuck Soper <email@hidden> wrote:
> Your message helps a lot. Yesterday, I finally got it working. I had been
> trying to load a custom view with constraints from a nib file into the
> cell of an NSTableView which was inside an NSSplitView. By isolating the
> constraints in my custom view, I discovered the errors I was making. That
> is, I first got my custom view working in the contentView of the window,
> then moved it within the NSSplitView, then moved it within an NSTableView
> (in the NSSplitView).
>
> I have what I need for now, but I wanted to let you know that I discovered
> with my implementation that I must call
> setTranslatesAutoresizingMaskIntoConstraints:NO for my programmatically
> created subviews or I get lots of constraint exceptions. I also override
> + (BOOL)requiresConstraintBasedLayout to return YES. For my
> NSTableCellView subclass I do not call
> setTranslatesAutoresizingMaskIntoConstraints: or override
> requiresConstraintBasedLayout. My custom view is a subview of my
> NSTableCellView subclass.
That sounds exactly right.
>
>
> One more question below...
>
>
> On 12/11/12 11:08 AM, "Peter Ammon" <email@hidden> wrote:
>> On Dec 8, 2012, at 4:19 PM, Chuck Soper <email@hidden> wrote:
>>
>>> Hi Peter,
>>>
>>> On 11/27/12 6:33 PM, "Chuck Soper" <email@hidden> wrote:
>>>> On 11/27/12 2:11 PM, "Peter Ammon" <email@hidden> wrote:
>>>>
>>>>> Hi Chuck,
>>>>>
>>>>> Autolayout works well with NSSplitView in 10.8.
>>>>
>>>> Perfect. Thanks for that confirmation.
>>>
>>> Does that mean that in 10.8 (and not 10.7) that it's fine to call
>>> setTranslatesAutoresizingMaskIntoConstraints:NO for subviews of
>>> NSSplitView?
>>
>> For controls that have traditionally positioned their subviews, like
>> NSTableView, NSSplitView, NSTabView, you can think of them as owning the
>> translatesAutoresizingMaskIntoConstraints properties of its subviews, and
>> it will set it appropriately depending on whether the view uses
>> autolayout or not.
>
> When you say "controls that have traditionally positioned their subviews,
> like NSTableView" is 'their subviews' referring to NSTableCellView but NOT
> a programmatically created subview within NSTableCellView? For my case,
> this was true.
Right, that's what I mean.
>
> I did read the "Adopting Auto Layout" section in the "Cocoa Auto Layout
> Guide" but I think that I need to re-read the section. The info in the
> "Adopting Auto Layout" section seems critical to developers writing new
> 10.8 applications, and the title and the fact that it's the last section
> of the guide suggests that the info is only applicable to adopting Auto
> Layout for existing apps.
>
Thanks, that's good feedback.
_______________________________________________
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