Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create custom toolbar in OS X?

Tags:

macos

swift

cocoa

I am trying to get the below effect in OS X.

I found out the first step is to create a custom toolbar, then hide the window title.

I have managed to hide the window title but I am new to OS X development so I am not sure how to create a custom toolbar.

Here is the effect I am trying to create (toolbar with a search field and maybe some buttons).

enter image description here

like image 273
manwholikesspritekit Avatar asked Dec 20 '25 18:12

manwholikesspritekit


1 Answers

You can easily customize the toolbar in Interface Builder. Click on the toolbar that you have dragged into the window. Now you can remove all the items in there and add the ones you would like to have. You can add anything from TextFields, Buttons to custom views.

Add items by dragging them from the object library into the "Allowed Toolbar Items" section. From there, drag them into the "Default Toolbar Items" section. Otherwise the control will be available to the user, but not in the toolbar until he customizes it.

You can align the controls by using the space and flexible space objects that can be found in the objects library of Xcode.

Aligning the controls works via drag and drop.

enter image description here

To center controls, simply add flexible spaces to the left and right of the control. enter image description here

like image 64
mangerlahn Avatar answered Dec 23 '25 12:12

mangerlahn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!