简体   繁体   中英

NSWindow with bottom bar and main view using storyboards

I'm trying to wrap my head around storyboards for Mac OS X and I am having some difficulty duplicating behavior that I can easily accomplish using XIBs. My app's main window contains a toolbar, a content area, and a bottom bar. In the bottom bar I have various controls such as a progress indicator and a segmented control that selects which view is displayed in the content area. A prototype of the window looks like: 一个示例窗口

Using XIBs I can easily place the segmented control in the bottom bar and wire up its action to swap the content view based on which segment is selected. Thus far I've been unable to accomplish this behavior using storyboards. How can this be done? I've tried a split view but wasn't able to fix the size of the bottom pane nor eliminate the divider. I was hoping it would be as simple as dragging views from the IB palette into the bottom bar but this action isn't allowed.

You may use the new NSTabViewController as the main View controller connected to the NSWindowController. NSTabViewController can allow you to have the tabs you want and switch between them. It also supports adding a toolbar to it at any position so this is what you can do:

  1. Add a NSToolbar to the NSWindowController,
  2. Add Toolbar support to the NSTabViewController and place it at the bottom (you can also place the tabs at the bottom).

This layout should hopefully make things work for you?

You can watch this video for more information about using Storyboards for OS X applications (there's also some detail about using NSTabViewController in it)

Storyboards and Controllers on OS X

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM