Advertisement
srcrane

lab3a .m file

Feb 4th, 2012
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.43 KB | None | 0 0
  1. //
  2. // Lab3AViewController.m
  3. // Lab3A
  4. //
  5. // Created by Stephen Crane on 2/3/12.
  6. // Copyright (c) 2012 __MyCompanyName__. All rights reserved.
  7. //
  8.  
  9. #import "Lab3AViewController.h"
  10.  
  11. @implementation Lab3AViewController
  12. @synthesize switch1;
  13. @synthesize switch2;
  14. @synthesize switch3;
  15. @synthesize switch4;
  16. @synthesize on;
  17. @synthesize value;
  18. @synthesize myProgressView;
  19.  
  20.  
  21. - (void)didReceiveMemoryWarning
  22. {
  23. [super didReceiveMemoryWarning];
  24. // Release any cached data, images, etc that aren't in use.
  25. }
  26.  
  27. - (IBAction)resetButtonPushed:(id)sender {
  28. [myProgressView setProgress:0 animated:1];
  29. [switch1 setOn:0];
  30. [switch2 setOn:0];
  31. [switch3 setOn:0];
  32. [switch4 setOn:0];
  33. }
  34.  
  35. #pragma mark - View lifecycle
  36.  
  37. - (void)viewDidLoad
  38. {
  39. [super viewDidLoad];
  40. // Do any additional setup after loading the view, typically from a nib.
  41. }
  42.  
  43. - (void)viewDidUnload
  44. {
  45.  
  46. [self setMyProgressView:nil];
  47. [self setSwitch1:nil];
  48. [self setSwitch2:nil];
  49. [self setSwitch3:nil];
  50. [self setSwitch4:nil];
  51. [super viewDidUnload];
  52. // Release any retained subviews of the main view.
  53. // e.g. self.myOutlet = nil;
  54. }
  55.  
  56. - (void)viewWillAppear:(BOOL)animated
  57. {
  58. [super viewWillAppear:animated];
  59. }
  60.  
  61. - (void)viewDidAppear:(BOOL)animated
  62. {
  63. [super viewDidAppear:animated];
  64. }
  65.  
  66. - (void)viewWillDisappear:(BOOL)animated
  67. {
  68. [super viewWillDisappear:animated];
  69. }
  70.  
  71. - (void)viewDidDisappear:(BOOL)animated
  72. {
  73. [super viewDidDisappear:animated];
  74. }
  75.  
  76. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
  77. {
  78. // Return YES for supported orientations
  79. return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
  80. }
  81.  
  82.  
  83.  
  84.  
  85.  
  86. - (IBAction)switchValueChanged:(UISwitch*)sender {
  87. if ([sender isOn]) {
  88. if ([switch1 isOn]){
  89. [self setValue:.25];
  90. }
  91. else{
  92. [self setValue:0];
  93. }
  94. if ([switch2 isOn]){
  95. [self setValue:.25];
  96. }
  97. else{
  98. [self setValue:0];
  99. }
  100. if ([switch3 isOn]){
  101. [self setValue:.25];
  102. }
  103. else{
  104. [self setValue:0];
  105. }
  106. if ([switch4 isOn]){
  107. [self setValue:.25];
  108. }
  109. else{
  110. [self setValue:0];
  111. }
  112. [self value];
  113.  
  114. } else {
  115. [myProgressView setProgress:0 animated:0];
  116. }
  117. }
  118. @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement