gpt4 book ai didi

macos - 更改菜单栏应用程序字体大小

转载 作者:行者123 更新时间:2023-12-03 16:51:16 25 4
gpt4 key购买 nike

是否存在更改菜单栏应用程序标题字体大小的简单方法,使@“title”显示比默认值更小(或更大)

statusItem = [[[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength] retain];

[statusItem setHighlightMode:YES];
[statusItem setTitle:@"title"];
[statusItem setMenu:statusMenu];

最佳答案

响应尤金,为了实现图标和标题显示,我使用了我计划在下面发布的方法

statusItem = [[[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength] retain];

NSFont *font = [NSFont fontWithName:@"LucidaGrande" size:12.0];
NSDictionary *attrsDictionary = [NSDictionary dictionaryWithObject:font forKey:NSFontAttributeName];
NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:@"title" attributes:attrsDictionary];

NSBundle *bundle = [NSBundle mainBundle];

statusImage = [[NSImage alloc] initWithContentsOfFile:[bundle pathForResource:@"icon" ofType:@"png"]];
statusHighlightImage = [[NSImage alloc] initWithContentsOfFile:[bundle pathForResource:@"icon-alt" ofType:@"png"]];

[statusItem setImage:statusImage];
[statusItem setAlternateImage:statusHighlightImage];
[statusItem setHighlightMode:YES];
[statusItem setAttributedTitle:attrString];
[statusItem setMenu:statusMenu];

我计划发布一个教程链接,该链接很好地解释了某些代码的大部分原因 http://www.sonsothunder.com/devres/revolution/tutorials/StatusMenu.html

关于macos - 更改菜单栏应用程序字体大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17266717/

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