NSStackView - Gravity Question
NSStackView - Gravity Question
- Subject: NSStackView - Gravity Question
- From: Dave <email@hidden>
- Date: Fri, 28 Aug 2015 14:18:54 +0100
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