On Mar 17, 2009, at 3:33 PM, Peter Ammon wrote:


On Mar 15, 2009, at 11:20 PM, Peter Zegelin wrote:

I have some text labels in a registration dialog that contain the application name eg

"xxx Demonstration"
"Thank you for purchasing xxx"

and so on.

I would like this registration dialog to be general enough that I can use it in multiple applications. Is there a simple way to replace the xxx with the actual application name at runtime? At the moment I'm thinking I'll have to wire every label up to my registration controller and do it in awakeFromNib, but I was hoping for something easier.

Thanks!

Peter

You could create a subclass of NSTextField that does its own replacement. That would save you from having to create outlets.


What I've been doing (in Mac OS X as well as iPhone OS) is to store a string template in my localized strings file. Then, use NSBundle APIs to fill in the app name at runtime.

For example:

[NSString stringWithFormat:NSLocalizedString (@"Welcome to %@", @"some comment"), [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"]];

___________________________________________________________
Ricky A. Sharp         mailto:rsh...@instantinteractive.com
Instant Interactive(tm)   http://www.instantinteractive.com



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to