OfflineSettingViewController.m 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //
  2. // OfflineSettingViewController.m
  3. // iSales-NPD
  4. //
  5. // Created by Ray on 5/11/16.
  6. // Copyright © 2016 United Software Applications, Inc. All rights reserved.
  7. //
  8. #import "OfflineSettingViewController.h"
  9. @interface OfflineSettingViewController ()
  10. @end
  11. @implementation OfflineSettingViewController
  12. - (void)viewDidLoad {
  13. [super viewDidLoad];
  14. // Do any additional setup after loading the view.
  15. NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
  16. bool offline = [defaults boolForKey:@"EnableOfflineMode"] ;
  17. self.switch_offline.on = offline;
  18. }
  19. - (void)didReceiveMemoryWarning {
  20. [super didReceiveMemoryWarning];
  21. // Dispose of any resources that can be recreated.
  22. }
  23. - (IBAction)onChangeOfflineSwitch:(id)sender {
  24. NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
  25. [defaults removeObjectForKey:@"EnableOfflineMode"];
  26. [defaults setBool:self.switch_offline.isOn forKey:@"EnableOfflineMode"];
  27. [defaults synchronize];
  28. }
  29. /*
  30. #pragma mark - Navigation
  31. // In a storyboard-based application, you will often want to do a little preparation before navigation
  32. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  33. // Get the new view controller using [segue destinationViewController].
  34. // Pass the selected object to the new view controller.
  35. }
  36. */
  37. @end