Post

Replies

Boosts

Views

Activity

Sidebar toolbar item expansion
I am struggling to fix a default behavior related to toolbars and sidebars. I want to have a sidebar with a number of toolbar items associated with it (the sidebar is adjustable and can be pretty big). This is what the top of the window looks like normally: When the sidebar is shrunk, I would expect that the now hidden toolbar items would collapse into an expansion arrow inside the sidebar. Instead, this arrow appears at the far right of the toolbar, as if the entire window itself had shrunk: I can access the hidden toolbar items from this arrow, so it is not broken functionally, but the UI is very counterintuitive in this case, and I don't see a way to fix it without re-creating this functionality completely (custom toolbar, custom toolbar items, event detection for resizing the split view, etc.) It is not fixed using a compact, unified, or expanded toolbar style. My question is, is there any built-in way to move this arrow, or associate it with the sidebar somehow? Or if I do have to recreate this, is there some kind of event detection for toolbar items becoming hidden?
1
0
577
Dec ’21
Storyboard custom instantiated window controller
I am getting what feels like a bug when trying to custom instantiate a window controller from a storyboard. I am using NSStoryboard.instantiateController(identifier: creator: ). The block of code in question is:let mainWindowController = storyboard.instantiateController(identifier: "Analysis Window Controller") { aDecoder in MainWindowController(coder: aDecoder) }I have SUCCESSFULLY used basically this exact code for custom instantiating the main view controller, and just assigning that view to a new window and a new window controller. That works fine. I can also instantiate the window controller the old fashioned way without custom initialization with instantiateController(identifier:). But when I try the above code for custom instantiation of the window controller I end up with the following error:Assertion failure in -[NSClassSwapper _createControllerForCreator:coder:]...Custom instantiated controller must call -[super initWithCoder:]Note that both my custom view controller class (which works) and my custom window controller class MainWindowController (which doesn't work) have implemented: required init?(coder: NSCoder) { super.init(coder: coder) }I know that this functionality is new as of OS 10.15, but the documentation says it should work for window controllers AND view controllers, and the error message does not make any sense to me. https://developer.apple.com/documentation/appkit/nsstoryboard/3203780-instantiateinitialcontroller
5
0
2.3k
Feb ’20