gpt4 book ai didi

swift - 隐藏 NSSearchField 的 lupe 图标

转载 作者:可可西里 更新时间:2023-11-01 00:42:07 26 4
gpt4 key购买 nike

我正在使用 NSSearchField(未子类化)。当它没有获得焦点时,placeholderString 居中。但是左边的 lupe 图标看起来有点偏移,所以实际上整个东西似乎没有居中。

是否可以隐藏 lupe 图标?

enter image description here

最佳答案

无法直接访问图标,因此解决方法是首先访问 NSSearchField 单元格(如图所示),然后访问其按钮单元格。

本例中的 self 是 NSSearchField 的一个实例

[(NSButtonCell *)[(NSSearchFieldCell *)self.cell searchButtonCell] setTransparent:YES];

默认搜索字段:

enter image description here

隐藏/透明图标:

enter image description here

关于swift - 隐藏 NSSearchField 的 lupe 图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42482902/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com