开发者

Is it possible to change the height/font size of an NSPathControl without subclassing NSPathControl/NSPathComponentCell?

I'd like to increase the height of an NSPathControl as w开发者_如何学编程ell as make the font size larger. Is there any way to do it without subclassing the control as discussed here?


No, I don't think so. It shouldn't be too hard to subclass the cell though.


Have you tried to modify NSPathControlItem/attributedTitle:

(Limitation: 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
}

Or try to create subclass.(I didn't test it)

PS I did see that the question was asked in 2010 and know that the method mentioned didn't exist at that time. Hope it helped someone.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜