Re: Application main menu title behavior change in 10.6
Re: Application main menu title behavior change in 10.6
- Subject: Re: Application main menu title behavior change in 10.6
- From: Jim Turner <email@hidden>
- Date: Tue, 8 Sep 2009 09:03:13 -0500
On Fri, Sep 4, 2009 at 9:03 PM, Peter Ammon<email@hidden> wrote:
>
> Hi Jim,
>
> First let me thank you for checking the release notes. However, that
> particular issue is unrelated, confusingly enough.
>
> Here's what's going on. The first menu item in the main menu (or more
> precisely, its submenu) is magic, in that when it becomes the first item,
> its title is ignored and instead the application name is used. This is why
> you do not have to update your MainMenu.nib every time you change your
> application name. In Leopard, there was a bug that caused this to be
> applied inconsistently. It sounds like your application was benefiting from
> this bug.
>
> You can change the title of the application menu, after you set the main
> menu, like so:
>
> [[[[NSApp mainMenu] itemAtIndex:0] submenu] setTitle:@"New Title"]
>
> Hope this helps,
> -Peter
>
>
Indeed it does help, Peter. I now see why I was so confused with the
behavior I was encountering when I tried setTitle: initially.
setTitle: does its business only if the new title is different than
the current title. We are building a new main menu with the new
application's name already in place.
Doing the following sets the menu's title correctly when the title is
already set to "New Title":
[[[[NSApp mainMenu] itemAtIndex:0] submenu] setTitle:@""]
[[[[NSApp mainMenu] itemAtIndex:0] submenu] setTitle:@"New Title"]
Always appreciative of the help, Peter. Thanks!
--
Jim
_______________________________________________
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