Questions tagged [nsstackview]

The `NSStackView` is an OS X AppKit class introduced in OS X 10.9. It represents a horizontal or vertical stack of views.

From Apple's docs:

(NSStackView) is used to layout horizontal or vertical stacks of views using auto layout. Necessary constraints will automatically be created and modified when adding and removing views from a stack view to maintain a cohesive layout. This behavior is extended by customizing various properties of the stack view and the views it holds. Decreasing the clipping resistance priority allows the stack view to become smaller than the the minimum required to hold the provided views. Depending on the visibility priority associated with the internal views, they may either overflow and clip off the side, or drop from the view hierarchy. These dropped views are still retained by the stack view, and will be reattached if the stack view becomes the necessary size. Views can be forced to be dropped or reattached by setting the necessary visibility priority.

47 questions
8
votes
2 answers

NSScrollView containing NSStackView. Why the NSStackView items from bottom to Top?

The NSScrollView containing a NSStackView. The NSStackView's items will add in runtime.The new NSStackView's items are from bottom to top, but I want they are from top to bottom. The main.storyboard The ViewController import Cocoa class…
Blaclittle
  • 117
  • 2
  • 5
4
votes
2 answers

Hide view item of NSStackView with animation

I working with swift 4 for macOS and I would like to hide an stack view item with animation. I tried this: class ViewController: NSViewController { @IBOutlet weak var box: NSBox! @IBOutlet weak var stack: NSStackView! var x = 0 …
Trombone0904
  • 4,132
  • 8
  • 51
  • 104
4
votes
2 answers

Drag views in NSStackView to rearrange the sequence

Is it possible to change the order of views in NSStackView by dragging the subviews, just like we do it in NSTableView ?
Kaunteya
  • 3,107
  • 1
  • 35
  • 66
4
votes
2 answers

How can you get an NSButton to detach from an NSStackView when the stack view resizes?

How can you get an NSButton to detach from an NSStackView when the stack view resizes? NSControl subclasses that use NSCell drawing seem to have a different mind than other NSView subclasses on visibility with compression resistance in Auto…
uchuugaka
  • 12,679
  • 6
  • 37
  • 55
3
votes
1 answer

NSStackView edgeInsets gets ignored

Using edgeInsets on NSStackView is ignored by Interface Builder and when running the app.
catlan
  • 25,100
  • 8
  • 67
  • 78
3
votes
1 answer

How to get an NSStackView as accessory view to NSAlert?

I'm writing an app with Swift on macOS. I want to create an NSAlert with a vertical NSStackView that will let the user pick one out of N options. To do that, I hook up my NSStackView in the accessoryView property of my NSAlert, and for some reason…
3
votes
2 answers

How to make buttons fill vertically in a NSStackView with a fixed height

The NSStackView shown above has top/leading/trailing constraints, a proportional height to its superview, and is set to Align Top and Fill Equally. I want to have the buttons stretch vertically to fill the height of their stack view. How can I…
elce
  • 264
  • 4
  • 16
3
votes
1 answer

NSStackView and subviews with intrinsic content size

I have an NSStackView created programatically to which I add a single NSButton. NSStackView *stackView = [[NSStackView alloc] initWithFrame:rect]; stackView.autoresizingMask = NSViewWidthSizable|NSViewHeightSizable; stackView.alignment…
pfandrade
  • 2,359
  • 15
  • 25
2
votes
3 answers

Horizontal StackView issue for multiline label and fixed size icon image

I want to show a an icon image which is fixed size of 20px X 20px ,It is showing good when a label is only one line but not showing accurately when label became in two lines.Screenshot is attached.
Gurpreet Singh
  • 803
  • 9
  • 16
2
votes
1 answer

How to add a view in a NSStackView with animation?

In interface builder, I have several views (A, B, C) in a NSStackView (vertical orientation). During runtime, I change dynamically the NSStackView by showing or hiding (isHidden) some of these embedded views through a property observer (willSet). If…
Joshua
  • 147
  • 1
  • 12
2
votes
1 answer

NSViewController IBOutlet is always nil

I have a Cocoa app that has a main NSWindowController and inside a NSView connected to a NSViewController object like this: CloudCardsViewController is a NSViewController with its Nib and IBOutlet to a NSStackView. When I try to access to the…
mhergon
  • 1,688
  • 1
  • 18
  • 39
2
votes
1 answer

How to make NSStackView truncate right-most NSTextField

I have one line in my UI, that consists of fixed-sized string (FS), fixed-sized image and variable-sized string (VS). I need this line to be centered in its superview, possibly truncating the VS if it no longer fits in. Just like simple centered…
2
votes
0 answers

Reusable NSView from Storyboard to Add to NSStackView

I have an NSViewController defined in my storyboard that contains a view that holds various labels and a button. They are aligned using auto layout. I want to use this as a UI prototype so that I can generate lots of these and add them to a…
Clifton Labrum
  • 13,053
  • 9
  • 65
  • 128
2
votes
1 answer

NSStackView and content hugging priority

NSStackView has 2 additional priorities compared to a regular NSView, namely clippingResistancePriority and huggingPriority. The documentation provides a somewhat reasonable explanation what they're for and what they do. But 4 priorities is a bit…
Alexander N.
  • 564
  • 3
  • 10
2
votes
2 answers

Autolayout: NSStackView won't resize parent view when height dynamically changed

Similar question: How to resize a parent view based on the size of subviews layouted with Autolayout I got an NSStackView which loads DisclosureViewControllers (NSViewController subclasses) just like in the Apple Example InfoBarStackView. Those can…
Julian Vogels
  • 668
  • 1
  • 6
  • 21
1
2 3 4