Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // Lab3AViewController.m
- // Lab3A
- //
- // Created by Stephen Crane on 2/3/12.
- // Copyright (c) 2012 __MyCompanyName__. All rights reserved.
- //
- #import "Lab3AViewController.h"
- @implementation Lab3AViewController
- @synthesize switch1;
- @synthesize switch2;
- @synthesize switch3;
- @synthesize switch4;
- @synthesize on;
- @synthesize value;
- @synthesize myProgressView;
- - (void)didReceiveMemoryWarning
- {
- [super didReceiveMemoryWarning];
- // Release any cached data, images, etc that aren't in use.
- }
- - (IBAction)resetButtonPushed:(id)sender {
- [myProgressView setProgress:0 animated:1];
- [switch1 setOn:0];
- [switch2 setOn:0];
- [switch3 setOn:0];
- [switch4 setOn:0];
- }
- #pragma mark - View lifecycle
- - (void)viewDidLoad
- {
- [super viewDidLoad];
- // Do any additional setup after loading the view, typically from a nib.
- }
- - (void)viewDidUnload
- {
- [self setMyProgressView:nil];
- [self setSwitch1:nil];
- [self setSwitch2:nil];
- [self setSwitch3:nil];
- [self setSwitch4:nil];
- [super viewDidUnload];
- // Release any retained subviews of the main view.
- // e.g. self.myOutlet = nil;
- }
- - (void)viewWillAppear:(BOOL)animated
- {
- [super viewWillAppear:animated];
- }
- - (void)viewDidAppear:(BOOL)animated
- {
- [super viewDidAppear:animated];
- }
- - (void)viewWillDisappear:(BOOL)animated
- {
- [super viewWillDisappear:animated];
- }
- - (void)viewDidDisappear:(BOOL)animated
- {
- [super viewDidDisappear:animated];
- }
- - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
- {
- // Return YES for supported orientations
- return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
- }
- - (IBAction)switchValueChanged:(UISwitch*)sender {
- if ([sender isOn]) {
- if ([switch1 isOn]){
- [self setValue:.25];
- }
- else{
- [self setValue:0];
- }
- if ([switch2 isOn]){
- [self setValue:.25];
- }
- else{
- [self setValue:0];
- }
- if ([switch3 isOn]){
- [self setValue:.25];
- }
- else{
- [self setValue:0];
- }
- if ([switch4 isOn]){
- [self setValue:.25];
- }
- else{
- [self setValue:0];
- }
- [self value];
- } else {
- [myProgressView setProgress:0 animated:0];
- }
- }
- @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement