Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reload if a setting is changed in the settings app while in background #31

Open
malhal opened this issue Mar 2, 2014 · 0 comments
Open

Comments

@malhal
Copy link

malhal commented Mar 2, 2014

If the in app settings controller is visible, if you leave the app and go to the Settings app and change a setting, when you come back to the app the settings controller still has the old values. Fix with these changes:

  • (void)viewWillAppear:(BOOL)animated {
    ...
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillEnterForeground:) name:UIApplicationWillEnterForegroundNotification object:nil];
    }
  • (void)viewWillDisappear:(BOOL)animated{
    ...
    [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillEnterForegroundNotification object:nil];
    }
    -(void)applicationWillEnterForeground:(NSNotification*)notify{
    // reload in settings in case they were changed in the prefs app.
    [[NSUserDefaults standardUserDefaults] synchronize];
    // show any changes if they happened in the background.
    [self.tableView reloadData];
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant