• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSStackView - Gravity Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: NSStackView - Gravity Question
      • From: Lee Ann Rucker <email@hidden>
    • Re: NSStackView - Gravity Question
      • From: Conrad Shultz <email@hidden>
    • Re: NSStackView - Gravity Question
      • From: email@hidden
  • Prev by Date: Re: setting tab stops in swift
  • Next by Date: Re: NSStackView - Gravity Question
  • Previous by thread: Re: setting tab stops in swift
  • Next by thread: Re: NSStackView - Gravity Question
  • Index(es):
    • Date
    • Thread