I am building two variants of a Mac app from one code base, using two targets, called "Free42 Decimal" and "Free42 Binary" in an Xcode project. The two variants should present identical UIs, with the variant names only showing up in the app name and the main window title.
However, the target name is used by Xcode for the app name and for the app menu title. It doesn't matter what I set the app menu title to in MainMenu.xib, something overrides it and sets it to the app name. In MainMenu.xib, the app menu title is set to just "Free42", which is what I want it to be, but it ends up being "Free42 Decimal" or "Free42 Binary" anyway.
I find that I can override this using
[[[[NSApp mainMenu] itemAtIndex:0] submenu] setTitle:@"Free42\u200b"];
(The \u200b is a zero-width space; when I try to set the title to exactly "Free42", it has no effect.)
However, while this does have the desired effect of setting the app menu title to "Free42", now the menu title is no longer bold, and I don't see how to make it bold again. Is it possible to fix that?
https://stackoverflow.com/questions/66775068/how-can-i-override-the-app-menu-title-in-a-mac-app March 24, 2021 at 01:07PM
没有评论:
发表评论