nsstackview

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

≯℡__Kan透↙ 提交于 2020-01-13 21:37:47
问题 Similar question: How to resize a parent view based on the size of subviews layouted with Autolayout I got an NSStackView which loads DisclosureViewController s (NSViewController subclasses) just like in the Apple Example InfoBarStackView. Those can expand and retract views of arbitrary height. I would like the parent view containing the NSStackView to resize its height according to the contents of the NSStackView . In the Apple example that works. However, unfortunately, Apple is resizing a

Embedding NSStackView as NSTableCellView in NSTableView

那年仲夏 提交于 2019-12-13 06:31:42
问题 I'm currently working on a prototype for a todo type app. I have a table which contains the user tasks. What I want to do is only present the user with pertinent task information. But to edit additional information, they would click on a disclosure button to expand the cell. I was thinking of two possible ways to handle this: Expanding NSTableViewCell Using an NSStackView as the contents of each cell If using the NSTableViewCell, I would probably have two NSViews to represent the cell (top

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

半城伤御伤魂 提交于 2019-12-07 06:36:50
问题 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 ViewController: NSViewController { var todoList:[Todo] = [] @IBOutlet weak var todosStackView: NSStackView! @IBOutlet weak var todosScrollView: NSScrollView! @IBAction func onEnter(sender: NSTextField) { let todo = Todo() todo.content = sender.stringValue self

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

孤街浪徒 提交于 2019-12-05 08:47:54
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 ViewController: NSViewController { var todoList:[Todo] = [] @IBOutlet weak var todosStackView: NSStackView! @IBOutlet weak var todosScrollView: NSScrollView! @IBAction func onEnter(sender: NSTextField) { let todo = Todo() todo.content = sender.stringValue self.todoList.append(todo) let todoItemView = TodoItem() todoItemView.setButtonType(.SwitchButton)

Hide view item of NSStackView with animation

左心房为你撑大大i 提交于 2019-12-04 02:00:13
问题 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 @IBAction func action(_ sender: Any) { if x == 0 { NSAnimationContext.runAnimationGroup({context in context.duration = 0.25 context.allowsImplicitAnimation = true self.stack.arrangedSubviews.last!.isHidden = true self.view.layoutSubtreeIfNeeded() x = 1 },