Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我目前正在设置菜单项以更改我的 Mac 应用程序中“单个”窗口的颜色。
[_window setBackgroundColor : [NSColor redColor]];
与“_window”相比,有没有办法在我的所有窗口中更改该菜单项?
你可以使用的windows方法NSApplication。
windows
NSApplication
这可能会这样做:
[[NSApp windows] makeObjectsPerformSelector:@selector(setBackgroundColor:) withObject:[NSColor redColor]];
(或者您可能需要一个 for 循环来更仔细地检查每个窗口。)