iPhone Developer Tips Visitor Stats: 126,691 Pageviews and 94,296 visitors in the past 30 days.
|
If you ever need to get the name of your application in code, for example, to display the application name across a navigation bar, it’s as near as the bundle for your application.
The code to get the name is as simple as this:
[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"];
The breakdown is as follows:
NSBundle mainBundle creates a bundle object that maps to the directory where the application lives.
infoDictionary returns a dictionary that contains the contents of the above bundles Info.plist
objectForKey:@”CFBundleName” will return the value for specified key, in our example, the name of the application.
Share with iOS Developers:
Leave Comment