From ee4cbc12735a86d2a69f25f6678a2cb3df0de7e2 Mon Sep 17 00:00:00 2001 From: Eddie Ehlin Date: Sat, 29 Dec 2012 02:21:33 +0100 Subject: Added controls + initial logic to Insta bean view --- .../UserInterfaceState.xcuserstate | Bin 14361 -> 18900 bytes iBean/iBean/InstaBeanViewController.h | 5 ++ iBean/iBean/InstaBeanViewController.m | 32 ++++++++++ .../en.lproj/MainStoryboard_iPhone.storyboard | 71 +++++++++++++++------ 4 files changed, 90 insertions(+), 18 deletions(-) diff --git a/iBean/iBean.xcodeproj/project.xcworkspace/xcuserdata/eddiex.xcuserdatad/UserInterfaceState.xcuserstate b/iBean/iBean.xcodeproj/project.xcworkspace/xcuserdata/eddiex.xcuserdatad/UserInterfaceState.xcuserstate index 14a11b0..a6b65d0 100644 Binary files a/iBean/iBean.xcodeproj/project.xcworkspace/xcuserdata/eddiex.xcuserdatad/UserInterfaceState.xcuserstate and b/iBean/iBean.xcodeproj/project.xcworkspace/xcuserdata/eddiex.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/iBean/iBean/InstaBeanViewController.h b/iBean/iBean/InstaBeanViewController.h index a6d7700..7dbb6de 100644 --- a/iBean/iBean/InstaBeanViewController.h +++ b/iBean/iBean/InstaBeanViewController.h @@ -9,5 +9,10 @@ #import @interface InstaBeanViewController : UIViewController +@property (weak, nonatomic) IBOutlet UILabel *extractionTimerLabel; +@property (weak, nonatomic) IBOutlet UIButton *extractionButton; +@property (weak, nonatomic) IBOutlet UIStepper *extractionSetupStepper; +@property (weak, nonatomic) IBOutlet UILabel *extractionTimerSettingLabel; +@property (nonatomic) BOOL extractionInProgress; @end diff --git a/iBean/iBean/InstaBeanViewController.m b/iBean/iBean/InstaBeanViewController.m index 776a8b5..e528122 100644 --- a/iBean/iBean/InstaBeanViewController.m +++ b/iBean/iBean/InstaBeanViewController.m @@ -14,6 +14,7 @@ @implementation InstaBeanViewController +/* - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; @@ -22,6 +23,7 @@ } return self; } + */ - (void)viewDidLoad { @@ -36,4 +38,34 @@ // Dispose of any resources that can be recreated. } + +//Insta bean methods +- (IBAction)setTimerInterval:(id)sender { + NSString *timerSetting = [NSString stringWithFormat:@"%1.0f", [self.extractionSetupStepper value]]; + NSLog(@"%@", timerSetting); + [self.extractionTimerSettingLabel setText:timerSetting]; +} + +- (IBAction)startExtraction:(id)sender { + if (self.extractionInProgress == NO) + { + //Update button text to "Stop extraction" + self.extractionInProgress = YES; + [self.extractionButton setTitle:@"Stop extraction" forState:UIControlStateNormal]; + [self.extractionButton setTintColor:[UIColor redColor]]; + //TODO: Set red background image. + //TODO: Start timer. + } + else + { + [self.extractionButton setTitle:@"Start extraction" forState:UIControlStateNormal]; + self.extractionInProgress = NO; + [self.extractionButton setTintColor:[UIColor greenColor]]; + //TODO: Set green background image. + //TODO: Halt timer + } + +} + + @end diff --git a/iBean/iBean/en.lproj/MainStoryboard_iPhone.storyboard b/iBean/iBean/en.lproj/MainStoryboard_iPhone.storyboard index d249629..0e1a2c4 100644 --- a/iBean/iBean/en.lproj/MainStoryboard_iPhone.storyboard +++ b/iBean/iBean/en.lproj/MainStoryboard_iPhone.storyboard @@ -50,31 +50,58 @@ - - + - - - - - - + + + + + + + + + - + + + + + + + @@ -110,6 +137,14 @@ + + + + + + + + -- cgit v1.2.3