Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift nstoolbaritem大小OS X_Swift_Macos_Cocoa_Toolbar - Fatal编程技术网

Swift nstoolbaritem大小OS X

Swift nstoolbaritem大小OS X,swift,macos,cocoa,toolbar,Swift,Macos,Cocoa,Toolbar,我和斯威夫特一起为osx工作,我有一个nstoolbaritem。 此工具栏项太大 我想把它缩小一点。 我试过这个: @IBOutlet weak var toolbarItem: NSToolbarItem! toolbarItem.maxSize = NSSize(width: 15, height: 15) 但是工具栏项目图像的大小没有改变:仅当您使用工具栏的自定义视图时,maxSize和minSize才适用 i、 e toolbarItem.view=MyCustomControlVi

我和斯威夫特一起为osx工作,我有一个nstoolbaritem。 此工具栏项太大

我想把它缩小一点。 我试过这个:

@IBOutlet weak var toolbarItem: NSToolbarItem!
toolbarItem.maxSize = NSSize(width: 15, height: 15)
但是工具栏项目图像的大小没有改变:

仅当您使用工具栏的自定义视图时,maxSize和minSize才适用

i、 e

toolbarItem.view=MyCustomControlViewframe:someRect

AppKit控件仅服从包含工具栏的sizeMode

有关详细信息,请参阅。

小星号:由于NSToolbar的实现方式,当工具栏大小模式更改时,只有覆盖NSControl的controlSize的控件才会更新。