Re: NSStackView - Gravity Question
Re: NSStackView - Gravity Question
- Subject: Re: NSStackView - Gravity Question
- From: email@hidden
- Date: Sat, 29 Aug 2015 00:01:39 +0900
You can add them to any gravity. Not all the same one even.
Basically the gravity areas mean views added to a gravity area are clustered toward that gravity.
If it's top, the line up against the top.
Bottom, they sit at the bottom.
Center gravity keeps that cluster centered on the center.
Think of it like aligning text or paragraphs in Pages.
The challenge of this view is that it is exceptionally generalized and basically invisible.
10.11 offers improvement.
Sent from my iPhone
> On Aug 28, 2015, at 10:18 PM, Dave <email@hidden> wrote:
>
> Hi,
>
> I’m looking at:
>
> https://developer.apple.com/library/mac/documentation/AppKit/Reference/NSStackView_Class/#//apple_ref/occ/clm/NSStackView/stackViewWithViews:
>
> and wondering if there is any better documentation available for NSStackView?
>
> It talks about "Gravity Areas" and I’m confused as to how they should be used. I basically want a StackView similar to the InfoBarView sample in that sample, it creates a Stack View like this:
>
> NSStackView *stackView = [NSStackView stackViewWithViews:@[
> self.header,
> self.shapeDisclosureViewController.view,
> self.imagePickerDisclosureViewController.view,
> self.otherDisclosureViewController.view]];
>
> // we want our views arranged from top to bottom
> stackView.orientation = NSUserInterfaceLayoutOrientationVertical;
>
> // the internal views should be aligned with their centers
> // (although since they'll all be the same width, it won't end up mattering)
> //
> stackView.alignment = NSLayoutAttributeCenterX;
>
> stackView.spacing = 0; // No spacing between the disclosure views
>
> // have the stackView strongly hug the sides of the views it contains
> [stackView setHuggingPriority:NSLayoutPriorityDefaultHigh forOrientation:NSLayoutConstraintOrientationHorizontal];
>
> // have the stackView grow and shrink as its internal views grow, are added, or are removed
> [stackView setHuggingPriority:NSLayoutPriorityDefaultHigh forOrientation:NSLayoutConstraintOrientationVertical];
>
> self.window.contentView = stackView;
>
> In this case, which Gravity ares are the views added to?
>
> In my code, I want to add new views to the Stack View using addView: inGravity: so to get the same results as the above, which Gravity do I specify?
>
> Thanks in advance for any help.
>
> All the Best
> Dave
>
>
>
>
>
>
> _______________________________________________
>
> 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