我知道如何更改文本颜色:
NSPathComponentCell *cell = [_pathControl pathComponentCells].firstObject;
cell setTextColor:[NSColor redColor];
但我也想改变箭头的颜色,有人知道如何实现吗?
我知道如何更改文本颜色:
NSPathComponentCell *cell = [_pathControl pathComponentCells].firstObject;
cell setTextColor:[NSColor redColor];
但我也想改变箭头的颜色,有人知道如何实现吗?
不支持开箱即用 - 您需要自己推出。
或者看看像 ITPathbar 这样的各种第 3 方实现: https ://www.cocoacontrols.com/controls/itpathbar
您是否尝试过修改NSPathControlItem/attributedTitle:
(限制:macOS 10.10+)
for pathControlItem in pathControl.pathItems {
let range = NSMakeRange(0, pathControlItem.attributedTitle.length)
let attributedTitle = NSMutableAttributedString(attributedString: pathControlItem.attributedTitle)
attributedTitle.addAttribute(.foregroundColor, value: yourColor, range: range)
pathControlItem.attributedTitle = attributedTitle
}
或者尝试创建子类。(我没有测试过)