Re: StackViews and XCode 6.4
Re: StackViews and XCode 6.4
- Subject: Re: StackViews and XCode 6.4
- From: Jonathan Mitchell <email@hidden>
- Date: Thu, 10 Sep 2015 10:38:37 +0100
Hi Dave
NSStackView works great and I use it extensively to build my entire UI, encapsulating one stack view inside another.
I don’t use XCode at all to manage the stack view content.
I generally create my stack view in code, set its properties then load in subviews from a nib(s).
I use a Stack view subclass at https://github.com/mugginsoft/TSStackView
This provides observation behaviour to remove a view form the stack using view.hidden. I find this very useful.
It also provides an auto height options that expands the stack to fit the content - very handy when embedding one stack view within another.
+ it provides an option to embed the stack view within a scroll view.
Getting the stack view internal and subview constraints sorted can be tricky.
The best approach is to start with nada and slowly add constrains one at a time.
Note that the stack view minimises its subviews by calling -fittingSIze.
If your view is not fully constrained in both width and height then the view will collapse in the stack view and effectively vanish.
If you ask Xcode to 'Add missing constraints' it will do so, but in general it will not add a constraint from the bottom subview to the container view.
Such a view will collapse in the stack view.
You need to add a vertical spacing constraint between the last subview and the container.
In general I use stack view as a universal layout container for main UI.
I don’t usually use the detachment/reattachment functionality.
Jonathan
> On 9 Sep 2015, at 17:46, Dave <email@hidden> wrote:
>
> HI,
>
> It is worth trying to use NSStackViews in XCode 6.4? I watched a WWDC 2015 video about auto layout and StackViews and it looks likes XCode 7 fixes a *lot* of issues with StackViews and auto layout in general.
>
> The reason I ask about XCode 6.4 is because I’m trying to take an existing View Hierarchy and add it to a StackVIew in the hope it will make layout easier. But I’m having all kind of problems setting this up in XCode 6.4 Mac OS X 10,10.
>
> I’m trying to do what is described here in XCode:
>
> https://developer.apple.com/videos/wwdc/2015/?id=218
>
> But of course 6.4 doesn’t have the “Add to Stack Button” so I’ve been trying to do it manually without much success.
>
> If I want to use StackVIew should I wait for XCode 7? If so does it also mean that I have to target 10.11 in order to make it work like in the above video?
>
> Any help or suggestions greatly appreciated.
>
> All the Best
> Dave
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Xcode-users mailing list (email@hidden)
> 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