Hi,

[self.pValidationIssueScrollView setBackgroundColor:[NSColor redColor]];
self.pValidationListStackView.wantsLayer = YES;
self.pValidationListStackView.layer.backgroundColor = [[NSColor blueColor] 
CGColor];

Did the trick!

When I run it, the StackView grows with the ScrollView, e.g. it’s Blue up until 
the V Scroll Bar on right, then it’s Red

So, I assume I need to somehow attach the LTWDetailView to the StackView by 
adding Constraints?

The DetailView is loaded from a NIB and has it’s own set of constraints if that 
makes a difference?

Thanks again,
All the Best
Dave

> On 14 Sep 2015, at 19:18, Jonathan Hull <jh...@gbis.com> wrote:
> 
> Oh yeah, it does on iOS, but not OS X.  Sorry about that.
> 
> On OS X, you need to layer back it and set the layer’s background color.
> 
> stackview.wantsLayer = YES
> stackview.layer.backgroundColor = [NSColor blueColor]
> 
> (Note: The above was written in mail, so it may take a little tweaking to 
> work)
> 
> Thanks,
> Jon
> 
>> On Sep 14, 2015, at 11:11 AM, Dave <d...@looktowindward.com> wrote:
>> 
>> 
>>> On 14 Sep 2015, at 18:50, Jonathan Hull <jh...@gbis.com> wrote:
>>> 
>>> You shouldn’t have to add any constraints to the direct children of a 
>>> StackView (and in fact, you will most likely get an error if you try), 
>>> since the StackView will make its own constraints and manages them for you.
>>> 
>>> My guess is that the StackView is not resizing with the ScrollView.  You 
>>> can test this by temporarily removing the detail view (and associated 
>>> constraints) and setting the StackView’s background color to some bright 
>>> color.
>> 
>> Unfortunately NSStackView doesn’t seem to have a setBackgroundColor method. 
>> I set it on the ScrollView, that that of course moves when I resize the 
>> window.
>> 
>> These are the frame rects after adding the DetailView to the StackView.
>> 
>> ScrollView Frame: {{20, 54}, {760, 355}}
>> ClipView Frame: {{1, 1}, {743, 353}}
>> StackView Frame: {{0, 0}, {744, 16}}                 
>> ???????????????????????????????
>> 
>> I can add as many views as I like to the StackView and it’s Scrolls 
>> correctly vertically, I just can’t get the Detail View to expand out in H. 
>> Yes,
>> 
>>> Constraints with ScrollViews are notoriously tricky…
>> 
>> You’re not wrong there!
>> 
>> Incidentally, I took another look at InfoBarView and it doesn’t handle 
>> window re-sizing so it’s not much good in this case.
>> 
>> Thanks a lot.
>> Cheers
>> Dave
>> 
>> 
>>>> On Sep 14, 2015, at 8:48 AM, Dave <d...@looktowindward.com> wrote:
>>>> 
>>>> 
>>>>> 
>>>>> In fact, with NSStackView you should just be able to set the content 
>>>>> hugging priority and it’ll just work
>>>>> 
>>>>> myDetailView = [myDetailViewController getPrimaryView];
>>>>> [self.pValidationListStackView addView:myDetailView 
>>>>> inGravity:NSStackViewGravityTop]; // NOTE: Should this not be 
>>>>> GravityLeading as you’re using a horizontal stack view?
>>>>> [myDetailView setContentHuggingPriority:NSLayoutPriorityDefaultLow 
>>>>> forOrientation:NSLayoutConstraintOrientationHorizontal];
>>>>> 
>>>>> and that’s all you should need.
>>>>> 
>>>>> iain
>>>> 
>>>> I tried that and it had no effect. When I resize the window the Scroll 
>>>> View Resizes (and I assume the StackView?) but the Detail View stays the 
>>>> same size - e.g. does not move with the right edge of the Scroll View.
>>>> 
>>>> Cheers
>>>> Dave
>>>> 
>>>> 
>>>> 
>>>> _______________________________________________
>>>> 
>>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>>> 
>>>> 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:
>>>> https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
>>>> 
>>>> This email sent to jh...@gbis.com
>>> 
>> 
>> 
>> _______________________________________________
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> 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:
>> https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
>> 
>> This email sent to jh...@gbis.com
> 


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to