为什么会这样:
如您所见,在“允许的工具栏项目”中,“PHP”工具栏项目的图像看起来不错,但当它实际位于工具栏中时,它会奇怪地缩放。
谢谢
最佳答案
在文档中找到这个:
The displayed resolution of an image item is dependent on the sizeMode of the toolbar. You should provide image representations specific to the default, regular and small size modes in a single image that supports multiple image representations such as icns or tiff. The appropriate image representation is automatically displayed for the toolbar's current sizeMode. If an appropriate representation is not available, the toolbar scales the representation to the appropriate size for the current mode, at a cost in performance and appearance. Images that are not square are scaled to fit. An image item’s image is also scaled down and used in the image item’s overflow menu item. (Emphasis added)
看来您可能想尝试摆弄 NSToolbarItem
的 minSize
和 maxSize
属性。
关于objective-c - NSToolbarItem 图像缩放,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1583064/