Search code examples
xcodecocoaautolayoutnssplitviewnstoolbar

How to make controller in NSToolbar moving with NSSplitViewController's view like Reeder or Mail.app


I am developing a cocoa application. It contains a toolbar having some feature buttons. Just like Reeder.

I want to resize the toolbar section while resizing the split view. Something works like below. How to implement this kind of feature?

Any one can help me or give some suggestions will be appreciated.

I am developing with XCode7, Swift and Storyboard.

enter image description here

enter image description here


Solution

  • Obviously there isn't any way to add a splitView to the toolbar itself and i suspect what we see in reeder is not a standard toolbar. In anycase to get this, i did the following

    1. Hidden titlebar, transparent toolbar and fullscreen view on main controller

    Add to MainWindowController ViewDidLoad

    1. Add custom views with a height of 38 to the very top of each of your "sourcelist (sidebar), contentlist (index list) and default area of your SplitViewController splitView items. Then add buttons to this splitView

    Do the same for the others

    1. This is what it should look like on the main window

    MainWindow View Resized

    1. If you want to get the complete toolbar look. create an outlet to all your customView with the 37 point height (the ones to which you added the buttons) and customize the background, adding a gradient and a bottom border enter image description here enter image description here