How do I implement a browser toolbar in Cocoa?

It seems like the best approach is to use NSToolbar. However, it is not obvious to me how to make the NSTextField in the NSToolbar flexible in width. Is it possible? The default behavior of a text box is to remain a constant width even if the toolbar is resized.

0


a source to share


1 answer


Make sure you set maxSize and minSize correctly on the toolbar item and then set the autosize mask to the textbox. You control the size of the toolbar view just as if it were in a window, or make sure its width is flexible in IB if you create it there, or specify NSViewWidthSizable if you create it in code.



+2


a source







All Articles