FlipsideViewController.m
上传用户:jjjjag8
上传日期:2017-04-17
资源大小:1443k
文件大小:1k
源码类别:

iPhone

开发平台:

MultiPlatform

  1. #import "FlipsideViewController.h"
  2. #import "MainViewController.h"
  3. @implementation FlipsideViewController
  4. @synthesize engineSwitch;
  5. @synthesize warpFactorSlider;
  6. - (void)viewDidLoad {
  7. //self.view.backgroundColor = [UIColor viewFlipsideBackgroundColor];
  8. NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
  9. engineSwitch.on  = ([[defaults objectForKey:kWarpDriveKey] isEqualToString:@"Engaged"]) ? YES : NO;
  10. warpFactorSlider.value = [defaults floatForKey:kWarpFactorKey];
  11. }
  12. - (void)viewWillDisappear:(BOOL)animated
  13. {
  14. NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
  15. NSString *prefValue = (engineSwitch.on) ? @"Engaged" : @"Disabled";
  16. [defaults setObject:prefValue forKey:kWarpDriveKey];
  17. [defaults setFloat:warpFactorSlider.value forKey:kWarpFactorKey];
  18. [super viewWillDisappear:animated];
  19. }
  20. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
  21. // Return YES for supported orientations
  22. return (interfaceOrientation == UIInterfaceOrientationPortrait);
  23. }
  24. - (void)didReceiveMemoryWarning {
  25. [super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
  26. // Release anything that's not essential, such as cached data
  27. }
  28. - (void)dealloc {
  29. [engineSwitch release];
  30. [warpFactorSlider release];
  31. [super dealloc];
  32. }
  33. @end