可能重复:
Is there anyway to set values in the settings.bundle from within the APPiPhone - 更改应用程序设置编程
我开发一个iPhone应用程序,会在某个时刻向用户提示提醒他们设置关闭。从那里他们可以选择启用并继续。我能够获取设置并在我的代码中使用,问题是以编程方式更改它们。下面是我有
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if(buttonIndex == 1){
// Get the application defaults
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSDictionary *appDefaults = [NSDictionary dictionaryWithObject:@"YES" forKey:@"enabledAutoCheck"];
// Set the new settings and save
[defaults registerDefaults:appDefaults];
[defaults synchronize];
}
}
我正在胡乱猜测(因为我才开始学习Objective-C和iPhone开发2天前!)它有事可做的事实,这是设置默认设置意味着它们仅在没有做出以前的设置时才使用。
这只是缺少一点点东西,或者是有另一种方法来改变最初设置后的设置吗?
感谢
非常感谢你!完美的作品:)是的,我知道,我使用InAppSettings工具包,它关注事物的UI侧。 – Peter