Can't align label on a Segmented Control in an NSToolbar

ぐ巨炮叔叔 提交于 2019-12-13 13:14:55

问题


As you can see from the screenshot, the View button text is aligned properly under Allowed Toolbar Items, but once I add it to the toolbar, it's aligned to the right. Why?


回答1:


You have to set sane minimum and maximum sizes for the toolbar item. I think you also have to make sure the autoresize masks (or constraints if you're using automatic layout) are set properly in the toolbar item's view (the NSSegmentedControl in this case). I don't have the "proper" settings handy but the min/max toolbar item size + correct autosizing behavior are the key here.



来源:https://stackoverflow.com/questions/8280710/cant-align-label-on-a-segmented-control-in-an-nstoolbar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!