From 0464611a929f181146c55f64bb42829e0e28ff7c Mon Sep 17 00:00:00 2001 From: Eddie Ehlin Date: Sat, 2 Feb 2013 17:10:25 +0100 Subject: Added reset button for extraction count. --- .../UserInterfaceState.xcuserstate | Bin 43341 -> 43024 bytes iBean/iBean/SettingsViewController.h | 1 + iBean/iBean/SettingsViewController.m | 24 +++++++++++++ iBean/iBean/iPhoneStoryboard.storyboard | 39 +++++++++++++++------ 4 files changed, 53 insertions(+), 11 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 bd3354c..c87b20a 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/SettingsViewController.h b/iBean/iBean/SettingsViewController.h index 86b14bd..bfee4f8 100644 --- a/iBean/iBean/SettingsViewController.h +++ b/iBean/iBean/SettingsViewController.h @@ -26,5 +26,6 @@ - (IBAction)countExtractionsSwitchChanged:(id)sender; - (IBAction)useThresholdsSwitchChanged:(id)sender; - (IBAction)extractionCountStepperChanged:(id)sender; +- (IBAction)resetExtractionCount:(id)sender; @end diff --git a/iBean/iBean/SettingsViewController.m b/iBean/iBean/SettingsViewController.m index 4b8f723..7290f6d 100644 --- a/iBean/iBean/SettingsViewController.m +++ b/iBean/iBean/SettingsViewController.m @@ -145,6 +145,30 @@ } } +- (void) resetExtractionCount:(id)sender +{ + if (self.configuration != nil) + { + NSError *error = [(AppDelegate*) [[UIApplication sharedApplication] delegate] setExtractionCount:[NSNumber numberWithInt:0]]; + self.extractionCountLabel.text = [self.configuration.extractionCount stringValue]; + self.extractionCountStepper.value = [self.configuration.extractionCount doubleValue]; + if (error != nil) + { + UIAlertView *setExtractionCountAlert = [[UIAlertView alloc] + initWithTitle:@"Configuration error!" + message:@"iBean was not able to save configuration attribute for \"Extraction count\"." + delegate:nil + cancelButtonTitle:@"OK" otherButtonTitles: nil]; + [setExtractionCountAlert show]; + } + else + { + self.extractionCountLabel.text = [self.configuration.extractionCount stringValue]; + self.extractionCountStepper.value = [self.configuration.extractionCount doubleValue]; + } + } +} + /***************************************************** Delegates *****************************************************/ diff --git a/iBean/iBean/iPhoneStoryboard.storyboard b/iBean/iBean/iPhoneStoryboard.storyboard index cec0cd1..0244142 100644 --- a/iBean/iBean/iPhoneStoryboard.storyboard +++ b/iBean/iBean/iPhoneStoryboard.storyboard @@ -1,7 +1,7 @@ - + - + @@ -225,11 +225,11 @@ - - + + - + + - - + + + + + + + - - - + @@ -1039,7 +1055,7 @@ - + @@ -1303,6 +1319,7 @@ + -- cgit v1.2.3