Sidebar automatically adjust to icon size change in system preferences

Viewed 165

Adopt the new look of macOS - WWDC 2020:

here we can see that NSOutlineView automatically scales both the text labels and the symbol images to match the preferred sidebar size in system preferences. This makes it really easy to support all three sizes in your sidebar.

How does the NSOutlineView or NSTableView need to be setup for this to work? If you add Outline View or Source List in Interface Builder this doesn't work out of the box.

System Preferences > General > Sidebar icon size

1 Answers

After you added Outline View or Source List in Interface Builder, select the Outline View object and go to the Size Inspector.

Change Row Size Style from Match Canvas to Default.

Size Inspector - Row Size Style - Default

Tech note: Under the hood this is done with the NSTableViewDefaultSizeMode global user defaults key.

Related