objective-c - NSToolbarItem 图像缩放

标签 objective-c cocoa scaling nstoolbar nstoolbaritem

为什么会这样:

如您所见,在“允许的工具栏项目”中,“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)

看来您可能想尝试摆弄 NSToolbarItemminSizemaxSize 属性。

关于objective-c - NSToolbarItem 图像缩放,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1583064/

相关文章:

cocoa - 当模式对话框打开时如何接收通知

ios - 使 UIImageView 保持在当前大小而不拉伸(stretch)图像?

css - 为什么所有 HTML 表单元素都非常大,并且系统范围的字体比例因子为 2.0?

objective-c - UIPicker 标签与输出不同

ios - AVAudioUnitSampler 错误 loadSoundBankAtURL -> 无法找到补丁 0 库 0x0/0

macos - 如何更改 CIFilter CIQRCodeGenerator 过滤器的背景色和前景色

C# PictureBox 控件闪烁/性能问题

iphone - 如何访问 UITableView subview 选择?

ios - 如何处理 dispatch_queue_t dispatch_get_local_queue dispatch_queue_create EXC BAD ACCESS?

cocoa - NSPopUpButton 箭头颜色