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

iPhone

开发平台:

MultiPlatform

  1. //
  2. //  MainViewController.m
  3. //  AppSettings
  4. //
  5. //  Created by Jeff LaMarche on 7/24/08.
  6. //  Copyright __MyCompanyName__ 2008. All rights reserved.
  7. //
  8. #import "MainViewController.h"
  9. #import "MainView.h"
  10. @implementation MainViewController
  11. @synthesize usernameLabel;
  12. @synthesize passwordLabel;
  13. @synthesize protocolLabel;
  14. @synthesize warpDriveLabel;
  15. @synthesize warpFactorLabel;
  16. @synthesize favoriteTeaLabel;
  17. @synthesize favoriteCandyLabel;
  18. @synthesize favoriteGameLabel;
  19. @synthesize favoriteExcuseLabel;
  20. @synthesize favoriteSinLabel;
  21. -(void)refreshFields
  22. {
  23. NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
  24. usernameLabel.text = [defaults objectForKey:kUsernameKey];
  25. passwordLabel.text = [defaults objectForKey:kPasswordKey];
  26. protocolLabel.text = [defaults objectForKey:kProtocolKey];
  27. warpDriveLabel.text = [defaults objectForKey:kWarpDriveKey];
  28. warpFactorLabel.text = [[defaults objectForKey:kWarpFactorKey] stringValue];
  29. favoriteTeaLabel.text = [defaults objectForKey:kFavoriteTeaKey];
  30. favoriteCandyLabel.text = [defaults objectForKey:kFavoriteCandyKey];
  31. favoriteGameLabel.text = [defaults objectForKey:kFavoriteGameKey];
  32. favoriteExcuseLabel.text = [defaults objectForKey:kFavoriteExcuseKey];
  33. favoriteSinLabel.text = [defaults objectForKey:kFavoriteSinKey];
  34. }
  35. - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
  36. if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
  37. // Custom initialization
  38. }
  39. return self;
  40. }
  41. - (void)viewDidLoad {
  42. [self refreshFields];
  43.  }
  44.  
  45. - (void)viewDidAppear:(BOOL)animated {
  46. [self refreshFields];
  47. [super viewDidAppear:animated];
  48. }
  49. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
  50. // Return YES for supported orientations
  51. return (interfaceOrientation == UIInterfaceOrientationPortrait);
  52. }
  53. - (void)didReceiveMemoryWarning {
  54. [super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
  55. // Release anything that's not essential, such as cached data
  56. }
  57. - (void)dealloc {
  58. [usernameLabel release];
  59. [passwordLabel release];
  60. [protocolLabel release];
  61. [warpDriveLabel release];
  62. [warpFactorLabel release];
  63. [favoriteTeaLabel release];
  64. [favoriteCandyLabel release];
  65. [favoriteGameLabel release];
  66. [favoriteExcuseLabel release];
  67. [favoriteSinLabel release];
  68. [super dealloc];
  69. }
  70. @end