Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

macOS Big Sur new toolbar button style

When I create an App with SwiftUI App Lifecycle the toolbar buttons match with the new Big Sur toolbar button style (with onHover effect style). But if I choose the conventional AppDelegate Lifecycle and customize the toolbar via Storyboards then I get this button style without onHover effect:

enter image description here

The button appears with a rectangle as background. Does anyone know how could I achieve the new style?

like image 320
AlbertUI Avatar asked Jul 13 '20 19:07

AlbertUI


3 Answers

I've got this effect after I set NSButton.showsBorderOnlyWhileMouseInside property.

button.setButtonType(.momentaryPushIn)
button.isBordered = true
button.showsBorderOnlyWhileMouseInside = true

result

like image 167
Marcin Avatar answered Oct 05 '22 12:10

Marcin


toolbarItem.isBordered = true

isBordered property will give you that hover effect.

like image 26
avostic11 Avatar answered Oct 05 '22 11:10

avostic11


I've just had this problem myself and found the following NSButton settings to work.

Button style = Textured Rounded  
Type = Momentary Light
like image 24
Tom Bradley Avatar answered Oct 05 '22 10:10

Tom Bradley