From dc1ac524758de9d136f41650a7dee3a5edab8358 Mon Sep 17 00:00:00 2001 From: Eddie Ehlin Date: Wed, 20 Mar 2013 21:17:07 +0100 Subject: Added table that holds extraction times for instant extraction (in memory). --- .../UserInterfaceState.xcuserstate | Bin 58590 -> 58038 bytes .../xcdebugger/Breakpoints.xcbkptlist | 6 +- iBean/iBean/InstantExtractionViewController.h | 4 +- iBean/iBean/InstantExtractionViewController.m | 63 +++++++++++++++++++++ iBean/iBean/iPadStoryboard.storyboard | 46 ++++++++++++++- iBean/iBean/iPhoneStoryboard.storyboard | 39 +++++++++++++ 6 files changed, 153 insertions(+), 5 deletions(-) (limited to 'iBean') 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 4fcc5fd..a4aeb08 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.xcodeproj/xcuserdata/eddiex.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist b/iBean/iBean.xcodeproj/xcuserdata/eddiex.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist index 1b45798..8003b60 100644 --- a/iBean/iBean.xcodeproj/xcuserdata/eddiex.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist +++ b/iBean/iBean.xcodeproj/xcuserdata/eddiex.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist @@ -8,11 +8,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "iBean/InstantExtractionViewController.m" - timestampString = "385133878.06268" + timestampString = "385501866.06976" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "91" - endingLineNumber = "91" + startingLineNumber = "97" + endingLineNumber = "97" landmarkName = "-haltExtractionTimer" landmarkType = "5"> diff --git a/iBean/iBean/InstantExtractionViewController.h b/iBean/iBean/InstantExtractionViewController.h index c6a1c78..d982ffb 100644 --- a/iBean/iBean/InstantExtractionViewController.h +++ b/iBean/iBean/InstantExtractionViewController.h @@ -8,10 +8,11 @@ #import -@interface InstantExtractionViewController : UIViewController +@interface InstantExtractionViewController : UIViewController @property (nonatomic, assign) double extractionProgress; @property (nonatomic, assign) BOOL extractionInProgress; +@property (nonatomic, strong) NSMutableArray *extractionTimes; /* Utility methods */ - (void) initViewController; @@ -25,6 +26,7 @@ @property (weak, nonatomic) IBOutlet UIStepper *extractionSettingStepper; @property (weak, nonatomic) IBOutlet UILabel *extractionProgressLabel; @property (weak, nonatomic) IBOutlet UILabel *extractionStateLabel; +@property (weak, nonatomic) IBOutlet UITableView *extractionTimesTableView; /* UI Actions */ - (IBAction)startExtraction:(id)sender; diff --git a/iBean/iBean/InstantExtractionViewController.m b/iBean/iBean/InstantExtractionViewController.m index 825d7ec..2b4c386 100644 --- a/iBean/iBean/InstantExtractionViewController.m +++ b/iBean/iBean/InstantExtractionViewController.m @@ -60,6 +60,12 @@ NSNumber* extractionTimerSetting = [(AppDelegate*) [[UIApplication sharedApplication] delegate] getInstantExtractionTimer]; [self.extractionSettingStepper setValue: extractionTimerSetting != nil ? [extractionTimerSetting doubleValue] : 0.0f]; [self updateExtractionSettingLabel]; + + //Allocate and init the array holding extraction times (in memory). + if (self.extractionTimes == nil) + { + self.extractionTimes = [[NSMutableArray alloc] init]; + } } - (void) updateExtractionProgressLabel @@ -96,6 +102,10 @@ - (void) timerInterrupted { + //Add extraction time to our array of extraction times (datasource for tableview) + [self.extractionTimes insertObject:[NSString stringWithString:self.extractionProgressLabel.text] atIndex:0]; + [self.extractionTimesTableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationAutomatic]; + //Return UI to "Start extraction" state. [self.extractionStateLabel setText:@"Press to start"]; [self.extractionSettingStepper setEnabled:YES]; @@ -138,4 +148,57 @@ { [(AppDelegate*) [[UIApplication sharedApplication] delegate] incrementExtractionCount]; } + +#pragma mark - UITableView datasource & delegate +- (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView +{ + return 1; +} + +- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + return self.extractionTimes.count; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + static NSString *CellIdentifier = @"ExtractionTimeCell"; + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; + + //Configure the cell and set its title + cell.textLabel.text = [NSString stringWithFormat:@"%@ s", [self.extractionTimes objectAtIndex:indexPath.row]]; + cell.detailTextLabel.text = @""; + return cell; +} + +// Override to support conditional editing of the table view. +- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath +{ + // Return NO if you do not want the specified item to be editable (we want to be able to REMOVE though). + return YES; +} + +// Override to support editing the table view. +- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath +{ + if (editingStyle == UITableViewCellEditingStyleDelete) { + // Delete the row from the data source + if (self.extractionTimes != nil) + { + [self.extractionTimes removeObjectAtIndex: indexPath.row]; + } + [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; + } + else if (editingStyle == UITableViewCellEditingStyleInsert) { + // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view + } +} + +// Override to support conditional rearranging of the table view. +- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath +{ + // Return NO if you do not want the item to be re-orderable. + return NO; +} + @end diff --git a/iBean/iBean/iPadStoryboard.storyboard b/iBean/iBean/iPadStoryboard.storyboard index 43803d6..ba076a3 100644 --- a/iBean/iBean/iPadStoryboard.storyboard +++ b/iBean/iBean/iPadStoryboard.storyboard @@ -115,19 +115,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + @@ -140,6 +182,7 @@ + @@ -1424,6 +1467,7 @@ + diff --git a/iBean/iBean/iPhoneStoryboard.storyboard b/iBean/iBean/iPhoneStoryboard.storyboard index 75a27b0..bf68193 100644 --- a/iBean/iBean/iPhoneStoryboard.storyboard +++ b/iBean/iBean/iPhoneStoryboard.storyboard @@ -110,22 +110,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -135,6 +173,7 @@ + -- cgit v1.2.3