Created
December 12, 2011 06:42
-
-
Save rhysforyou/1465451 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // DurationPickerViewController.m | |
| // Tomato | |
| // | |
| // Created by Rhys Powell on 12/12/11. | |
| // Copyright (c) 2011 Smith's Hill High School. All rights reserved. | |
| // | |
| #import "DurationPickerViewController.h" | |
| @implementation DurationPickerViewController | |
| @synthesize pomodoroPicker = _pomodoroPicker; | |
| @synthesize pomodoroLabel = _pomodoroLabel; | |
| @synthesize minutesLabel = _minutesLabel; | |
| @synthesize pomodoroCount = _pomodoroCount; | |
| - (void)didReceiveMemoryWarning | |
| { | |
| // Releases the view if it doesn't have a superview. | |
| [super didReceiveMemoryWarning]; | |
| // Release any cached data, images, etc that aren't in use. | |
| } | |
| #pragma mark - View lifecycle | |
| /* | |
| // Implement loadView to create a view hierarchy programmatically, without using a nib. | |
| - (void)loadView | |
| { | |
| } | |
| */ | |
| // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. | |
| - (void)viewDidLoad | |
| { | |
| [super viewDidLoad]; | |
| self.pomodoroCount = 1; | |
| int minutes = self.pomodoroCount * 25; | |
| self.minutesLabel.text = [NSString stringWithFormat:@"%d Minutes", minutes]; | |
| } | |
| - (void)viewDidUnload | |
| { | |
| [super viewDidUnload]; | |
| // Release any retained subviews of the main view. | |
| // e.g. self.myOutlet = nil; | |
| } | |
| - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation | |
| { | |
| // Return YES for supported orientations | |
| return (interfaceOrientation == UIInterfaceOrientationPortrait); | |
| } | |
| # pragma mark - Picker view data source | |
| - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView | |
| { | |
| return 1; | |
| } | |
| - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component | |
| { | |
| return 99; | |
| } | |
| # pragma mark - Picker view delegate | |
| - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component | |
| { | |
| return @"Foo"; | |
| } | |
| - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component | |
| { | |
| self.pomodoroCount = row; | |
| self.pomodoroLabel.text = [NSString stringWithFormat:@"%@ Pomodoros", self.pomodoroCount]; | |
| int minutes = self.pomodoroCount * 25; | |
| self.minutesLabel.text = [NSString stringWithFormat:@"%d Minutes", minutes]; | |
| } | |
| @end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment