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
2
votes
1 answer

Views not displaying correctly after adding them to NSStackView programmatically

I'm trying to add some views (NSTextField in this example) to NSStackView: I've added NSStackView instance into XIB file, linked it to outlet as widgets into Document. In ...didLoadNib I'm doing this: NSTextField *tf = [[NSTextField alloc]…
ShadowPrince
  • 127
  • 1
  • 1
  • 8
2
votes
1 answer

NSStackView places NSViews on the baseline

Having reviewed most of Apple's (paucity) of documentation regarding NSStackView, plus the wise words of the greater Internet, including the collective wisdom of Stackoverflow, a problem remains. Any NSView I add programmatically to my (IB…
2
votes
3 answers

Using Cocoa autolayout to hide and show a view

I'm trying to hide and show view #1 in the following picture based on whether the button is clicked using Autolayout. Anyone know how to do this? I tried setting two NSLayoutConstraints for view #2, one where it is tied to the top of the superview…
matthewjselby
  • 112
  • 2
  • 8
1
vote
1 answer

Best way to print a NSTableView - Swift 5 + cocoa

I am new in Swift cocoa programming and I am trying build a finance program. I am almost done but I am stuck with the following problem. I am trying to print a multipage NStableView from a storyboard with textlabel bfore and after. I can print…
S Lareau
  • 159
  • 1
  • 5
1
vote
0 answers

Side-by-side NSTableView using StackView and Constraints

I am creating an app for macOS using XIB and Swift, XCode 12.5. What I would like to achieve is a window with two NSTableViews side-by-side, having equal widths, filling the available space. A Stack View seems the obvious choice here. I am easily…
1
vote
1 answer

How to inject a NSStackView into the view hierarchy?

I have an OSX application written in Objective-C. It displays some NSView in a NSWindow, the problem is I cannot modify its code. The original model hierarchy looks like this: NSWindow |---> original NSView |---> (...) I'd like to alter the…
Radek
  • 846
  • 4
  • 17
1
vote
0 answers

Programmatically adding a NSTableView to a NSStackView

I was wondering about programmatically adding a NSTableView inside a NSStackView using Swift 3/MacOS Sierra. The idea would be to have say 2 NSTextFields aligned via the centerY axis in the .leading gravity space, then a tableview in the .center…
toombzie
  • 47
  • 8
1
vote
0 answers

redundant border in NSStackview

Good morning :) I working with swift 4 for macOS and play the first time with NSStackViews. I build a litte example: NStackView includes three NSBoxes all boxes have a 1px border (different colors), which i setted via Storyboard. The "beautiful"…
Trombone0904
  • 4,132
  • 8
  • 51
  • 104
1
vote
2 answers

Programmatically adding InterfaceBuilder-created views to an NSStackView squashes them to 0 height

I've been trying to add a custom view I've created in Interface Builder to an NSStackView, but am failing miserably. This is my view controller. It currently does nothing but initialize the view from the NIB: class ServiceControlViewController :…
fresskoma
  • 25,481
  • 10
  • 85
  • 128
1
vote
1 answer

Hidden view in NSStackView not hiding?

I have created a vertical NSStackView that contains two NSView subclasses (they are just NSViews that draw a background color). I have the stack view set to detach hidden views. I have set one of the views to be hidden. Neither view hides in the…
Aaron
  • 879
  • 7
  • 18
1
vote
0 answers

Looking for control used in top Contacts page (NSStackView?)

I am quite new to Cocoa and I am looking for the control/view that is used in Contacts App "main" view. Specifically with the scrolling behaviour seen below, where a line appears when you scroll: I have been experimenting with NSStackView and…
scx
  • 3,221
  • 1
  • 19
  • 37
1
vote
1 answer

Multiple instances of a single content view in NSStackView

I am creating an application that need to have a progress window in which i want to dynamically insert a subview for each item being processed, like Finder's copy files panel window. And also remove it dynamically when processing is done. I want to…
1
vote
1 answer

NSStackView only shows newest custom view

I have a custom view controller class. I want to instantiate multiple custom view controllers and add their views to my NSStackView. I add a new view to the stack view by clicking a button. The button calls this method: [stackView…
user2320861
  • 1,391
  • 2
  • 11
  • 28
1
vote
1 answer

How to make a modular NSViewController based disclosure view where all disclosed views are contained in their own NIB?

In real apps the view hierarchy can be complex at it really helps to be able to put different views in different nibs. I am following InfoBarStackView example project they give a really nice example of how to use the new NSStackView class which…
Daniel Farrell
  • 9,316
  • 8
  • 39
  • 62
0
votes
0 answers

How to add animation to NSStackView?

I am making a taskbar thumbnail preview program that mimics Windows. I have completed many parts. First, when the width of my entire frame is greater than the screen width, the entire frame will be reduced in equal proportion to ensure that the…