• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Changing app menu title programmatically
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Changing app menu title programmatically


  • Subject: Changing app menu title programmatically
  • From: Matthew Gertner <email@hidden>
  • Date: Thu, 14 Feb 2008 19:33:04 +0100
  • Organization: AllPeers

Hi,

Our application lets the user create new app bundles that have their own name, icon, etc. but which actually spawn the original application (with the appropriate command-line parameters) using exec. I would like the generated app bundle to display the name of that application as the title of the application menu. But since it's spawning the original app, it uses its title. For example, if I use the original app "Foo" to create a new app bundle called "Bar", I'll see "Bar" on my desktop with the right icon, etc. But when I run it, it actually runs Foo (since the bar executable is just a script that calls "exec foo") and the title of the app menu is still "Foo".

I can see two possible ways to fix this. One is to change something in Bar's app bundle so that the right name is used. I tried changing CFBundleName in Info.plist, however, and this doesn't appear to have any effect. Whatever I try, the name from the spawned app bundle (Foo) is always used.

I also tried changing the menu title programmatically by registering a notification sink for NSApplicationDidFinishLaunchingNotification. I read somewhere that I should use:

[[NSApp mainMenu] itemAtIndex:0] submenu]

...to get the application menu. When I do so, I get a menu with the title "Apple" (rather than "Foo" which is what I expected). When I change the title (using setTitle), the change is not reflected in the UI.

Am I way off base in taking this approach? If so, what approach would you recommend? If not, what do I need to do to get the menu's title to change in the UI?

Thanks in advance,
Matt
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Changing app menu title programmatically
      • From: Nir Soffer <email@hidden>
    • Re: Changing app menu title programmatically
      • From: John Stiles <email@hidden>
  • Prev by Date: Re: Newbie Issue: isDescendantOf: error
  • Next by Date: Re: Newbie Issue: isDescendantOf: error
  • Previous by thread: Re: Newbie Issue: isDescendantOf: error
  • Next by thread: Re: Changing app menu title programmatically
  • Index(es):
    • Date
    • Thread