I have a segmented control in an NSToolbar, very similar to the one in iBooks app.
How could i force this control to stay centered when the window is resized?
I added to flexible space items, but they don't seem to center the control properly.
I have a segmented control in an NSToolbar, very similar to the one in iBooks app.
How could i force this control to stay centered when the window is resized?
I added to flexible space items, but they don't seem to center the control properly.
You could try using NSView in your toolbar and Auto Layout to center the control. That will give you much finer control than those flexible space items.
If you open your main nib or storyboard and double-click on the toolbar to access the list of toolbar items, you can drop a view in there and use NSToolbarItem to host it in the toolbar. I've had trouble with the view failing to appear when placed directly in IB, so I'd recommend that you just place a container view in your toolbar item, create an outlet to it, place your segmented control in a separate top-level view in your nib or scene with another outlet, and insert the "real" view programmatically into the container you put in the toolbar. (Don't forget to set up your constraints and translatesAutoresizingMaskIntoConstraints property!)