PDA

View Full Version : Reading Straight From the Settings Bundle




matthew858
Apr 12, 2009, 11:06 PM
I have an app that chooses whether or not to display a tab on a UITabBar based on the Settings application. Is there a way to read straight from the Settings bundle to modify whether or not to display my data?

At the moment, I am reading from Info.plist as follows:


NSBundle *bundle = [NSBundle mainBundle];
NSDictionary *info = [bundle infoDictionary];

if ([info boolForKey:@"showStore"] == YES)
{
localNavigationController = [self createNavigationControllerWrappingViewControllerForDataSourceOfClass:[StoreClass class]];
[localViewControllersArray addObject:localNavigationController];

[localNavigationController release];
}




But I am having a hard time getting the Settings bundle to modify what is in Info.plist, then having the app detect whether or not to display the tab.

If it is possible, how would I go about doing it (and since I'm new to coding, do you possibly have some sample code:o)?



kainjow
Apr 14, 2009, 04:21 PM
I haven't used the settings bundle thing before, but I think you need to use NSUserDefaults to read the values it sets in your app.