質問

I have created a setting.bundle in my iPhone app project. Its working fine. An application setting are visible in iPhone default Settings application with application icon and name.

I have also created a UIViewController in my app which contains the same setting functions which are in setting.bundle's Root.plist.

Means I have same setting view both in iPhone default Setting app and in my app setting viewcontroller.

When I apply some changes in iPhone default settings of my app, its reflect changes in my application from NSNotification object.

But problem occurs when I do some changes in my application settings viewcontroller, I can't apply this changes in iPhone default setting app. I want both setting page work synchronously. Both setting page needs to reflect them changes on each other.

One logic I found is this: need to modify settings.bundle's Root.plist within my application, parallel with application setting viewcontroller. But How to modify it, If I will succeed in modifying it, will it effect my iPhone default setting app's settings?

Second: Is is possible to send any notifications from application to iPhone default settings application to change its value?

Help me to solve this.

If I am not succeed to explain you my issue, please ask me. I will explain you in brief.

Thanks in advance.

役に立ちましたか?

解決

1) You can change the value of settings app programmatically.

You need to call registerDefaults for changing the settings value programmatically like:

[defaults setObject:@"YES" forKey:@"Toggle];

store a setting then [defaults synchronize]; for saving the settings.

Here Toggle is the identifier given to any of the settings component.

2) Add your class as observer for NSUserDefaultsDidChangeNotification like:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changed) name:NSUserDefaultsDidChangeNotification object:nil];

- (void) changed
{
  //change the app viewcontroller settings here
}

And change the viewControllers settings in the above method.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top