diff --git a/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.pbxproj b/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.pbxproj index 836819b..f90dfa4 100644 --- a/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.pbxproj +++ b/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.pbxproj @@ -382,6 +382,7 @@ CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -421,6 +422,7 @@ CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = YES; ENABLE_NS_ASSERTIONS = NO; diff --git a/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate b/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate index fabdbd0..b2c0e25 100644 --- a/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate +++ b/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate diff --git a/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/xcuserdata/imanol.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/xcuserdata/imanol.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index 5d71db4..57e6d72 100644 --- a/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/xcuserdata/imanol.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/DUREX Vendor Control/DUREX Vendor Control.xcodeproj/xcuserdata/imanol.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -17,6 +17,52 @@ endingLineNumber = "20" landmarkName = "+sharedProtocol" landmarkType = "5"> + + + + + + + + + + diff --git a/DUREX Vendor Control/FirstAppExample/MainStoryboard.storyboard b/DUREX Vendor Control/FirstAppExample/MainStoryboard.storyboard index 0aba99e..2e55356 100644 --- a/DUREX Vendor Control/FirstAppExample/MainStoryboard.storyboard +++ b/DUREX Vendor Control/FirstAppExample/MainStoryboard.storyboard @@ -78,35 +78,25 @@ - + - + - - - - - - - - - - - diff --git a/DUREX Vendor Control/MenuTableViewController.h b/DUREX Vendor Control/MenuTableViewController.h index 8f516e6..98c31da 100644 --- a/DUREX Vendor Control/MenuTableViewController.h +++ b/DUREX Vendor Control/MenuTableViewController.h @@ -15,9 +15,11 @@ #define MENU_ELEMENTS @"Maintenance",@"Basic Configuration",@"Sending a Report" #define MENU_CELLS_PER_SECTION num(3) +#define MENU_HEADERS nil #define MAINTENANCE_ELEMENTS @"Time",@"20€ Notes",@"10€ Notes",@"5€ Notes",@"2€ Coins",@"1€ Coins",@"50c Coins",@"CPP_TABLE",@"1€ Change",@"50c Change" -#define MAINTENANCE_CELLS_PER_SECTION num(10) +#define MAINTENANCE_CELLS_PER_SECTION num(10),num(0) +#define MAINTENANCE_HEADERS @"Status",@"Sensors" #define CELL_IDENTIFIERS @"MenuCell",@"MaintenanceCell",@"ConfigCell",@"ReportCell" @@ -26,9 +28,8 @@ enum { MENU = 0, MAINTENANCE, - STATUS, BASIC_CONFIGURATION, - REPORT + REPORT, } navigationLevel; @interface MenuTableViewController : UITableViewController diff --git a/DUREX Vendor Control/MenuTableViewController.m b/DUREX Vendor Control/MenuTableViewController.m index 32d90a6..6001180 100644 --- a/DUREX Vendor Control/MenuTableViewController.m +++ b/DUREX Vendor Control/MenuTableViewController.m @@ -15,9 +15,11 @@ } @property (nonatomic,strong) const NSArray *menuElements; @property (nonatomic,strong) const NSArray *menuStructure; +@property (nonatomic,strong) const NSArray *menuHeaders; @property (nonatomic,strong) const NSArray *maintenanceElements; @property (nonatomic,strong) const NSArray *maintenanceStructure; +@property (nonatomic,strong) const NSArray *maintenanceHeaders; @property (nonatomic,strong) const NSArray *cellIdentifiers; @@ -26,6 +28,7 @@ @property NSString *currentCellIdentifier; @property const NSArray *currentElements; @property const NSArray *currentStructure; +@property const NSArray *currentHeaders; @end @@ -45,9 +48,25 @@ { [self setMenuElements:[[NSArray alloc] initWithObjects:MENU_ELEMENTS, nil]]; [self setMenuStructure:[[NSArray alloc] initWithObjects:MENU_CELLS_PER_SECTION, nil]]; + if([[self menuStructure] count] > 1) + { + [self setMenuHeaders:[[NSArray alloc] initWithObjects:MENU_HEADERS, nil]]; + } + else + { + [self setMenuHeaders:nil]; + } [self setMaintenanceElements:[[NSArray alloc] initWithObjects:MAINTENANCE_ELEMENTS, nil]]; [self setMaintenanceStructure:[[NSArray alloc] initWithObjects:MAINTENANCE_CELLS_PER_SECTION, nil]]; + if([[self maintenanceStructure] count] > 1) + { + [self setMaintenanceHeaders:[[NSArray alloc] initWithObjects:MAINTENANCE_HEADERS, nil]]; + } + else + { + [self setMaintenanceHeaders:nil]; + } [self setCellIdentifiers:[[NSArray alloc] initWithObjects:CELL_IDENTIFIERS, nil]]; } @@ -61,18 +80,29 @@ { [self setCurrentElements:[self maintenanceElements]]; [self setCurrentStructure:[self maintenanceStructure]]; + [self setCurrentHeaders:[self maintenanceHeaders]]; } //AND SO ON... else { [self setCurrentElements:[self menuElements]]; [self setCurrentStructure:[self menuStructure]]; + [self setCurrentHeaders:[self menuHeaders]]; } - - NSRange range = NSMakeRange(0, [self numberOfSectionsInTableView:self.tableView]); + [[self tableView] reloadData]; + NSRange range = NSMakeRange(0, [self numberOfSectionsInTableView:[self tableView]]); NSIndexSet *sections = [NSIndexSet indexSetWithIndexesInRange:range]; - [self.tableView reloadSections:sections withRowAnimation:UITableViewRowAnimationAutomatic]; + [[self tableView] reloadSections:sections withRowAnimation:UITableViewRowAnimationAutomatic]; +} +- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section +{ + NSString *title = @""; + if([self currentHeaders] != nil) + { + title = [[self currentHeaders] objectAtIndex:section]; + } + return title; } - (void)viewDidLoad @@ -163,10 +193,12 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + NSLog(@"Section: %ld Row: %ld",(long)[indexPath section],(long)[indexPath row]); [tableView deselectRowAtIndexPath:indexPath animated:YES]; NSString *cellName = [[[[self tableView] cellForRowAtIndexPath:indexPath]textLabel]text]; if([cellName isEqualToString:@"Maintenance"]) { + NSLog(@"Changing to navLevel: MAINTENANCE"); [self changeNavLevel:MAINTENANCE]; } } @@ -185,14 +217,41 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + NSLog(@"navLevel is %d",[self currentNavLevel]); UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:[self currentCellIdentifier] forIndexPath:indexPath]; if (cell == nil) { - cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:[self currentCellIdentifier]]; + NSLog(@"Initializing cell"); + if([self currentNavLevel] == MAINTENANCE) + { + NSLog(@"Dispatching Maintenance-type cell"); + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:[self currentCellIdentifier]]; + } + else + { + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:[self currentCellIdentifier]]; + } + } + uint8_t offset = 0; + if([indexPath section] ) + { + for (int i = 0; i < [indexPath section]; i++) + { + offset += [[[self currentStructure] objectAtIndex:i] unsignedCharValue]; + } + } + [[cell textLabel] setText:[[self currentElements] objectAtIndex:[indexPath row]+offset]]; + if([self currentNavLevel] == MAINTENANCE) + { + NSLog(@"Customizing cell for navLevel MAINTENANCE"); + [[cell detailTextLabel] setText:@"VALUE"]; + [cell setAccessoryView: [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"icon_checkmark"]]]; + if( [[[cell textLabel] text] isEqualToString:@"5€ Notes"]) + { + [cell setAccessoryView: [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"icon_delete"]]]; + } } - - [[cell textLabel] setText:[[self currentElements] objectAtIndex:indexPath.row]]; return cell; } diff --git a/DUREX Vendor Control/Stack.m b/DUREX Vendor Control/Stack.m index 1a635be..0a40b75 100644 --- a/DUREX Vendor Control/Stack.m +++ b/DUREX Vendor Control/Stack.m @@ -27,7 +27,7 @@ - (void) push: (id) element { [[self dataArray] addObject:element]; - printf("%d elements in array\n",[self count]); + printf("%ld elements in array\n",(long)[self count]); } - (id) pop { diff --git a/DUREX tests/DUREX test.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate b/DUREX tests/DUREX test.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate index 5c1d6a5..21bfaef 100644 --- a/DUREX tests/DUREX test.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate +++ b/DUREX tests/DUREX test.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate diff --git a/DUREX tests/FirstAppExample/MainStoryboard.storyboard b/DUREX tests/FirstAppExample/MainStoryboard.storyboard index 2fa13e4..0381df0 100644 --- a/DUREX tests/FirstAppExample/MainStoryboard.storyboard +++ b/DUREX tests/FirstAppExample/MainStoryboard.storyboard @@ -1,8 +1,8 @@ - + - + @@ -79,7 +79,7 @@ - + @@ -87,12 +87,19 @@ + @@ -175,4 +182,4 @@ - \ No newline at end of file + diff --git a/DUREX tests/MenuTableViewController.m b/DUREX tests/MenuTableViewController.m index d4b84de..7dca23b 100644 --- a/DUREX tests/MenuTableViewController.m +++ b/DUREX tests/MenuTableViewController.m @@ -167,6 +167,7 @@ NSString *cellName = [[[[self tableView] cellForRowAtIndexPath:indexPath]textLabel]text]; if([cellName isEqualToString:@"Maintenance"]) { + NSLog(@"Changing to navLevel: MAINTENANCE"); [self changeNavLevel:MAINTENANCE]; } @@ -187,12 +188,15 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + NSLog(@"navLevel is %d",[self currentNavLevel]); UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:[self currentCellIdentifier] forIndexPath:indexPath]; if (cell == nil) { + NSLog(@"Initializing cell"); if([self currentNavLevel] == MAINTENANCE) { + NSLog(@"Dispatching Maintenance-type cell"); cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:[self currentCellIdentifier]]; } else @@ -211,14 +215,14 @@ [[cell textLabel] setText:[[self currentElements] objectAtIndex:[indexPath row]+offset]]; if([self currentNavLevel] == MAINTENANCE) { + NSLog(@"Customizing cell for navLevel MAINTENANCE"); [[cell detailTextLabel] setText:@"VALUE"]; - [cell setAccessoryView: [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"icon_checkmark"]]]; - if( [[[cell textLabel] text] isEqualToString:@"5€ Notes"]) - { - [cell setAccessoryView: [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"icon_delete"]]]; - } + [cell setAccessoryView: [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"icon_checkmark"]]]; + if( [[[cell textLabel] text] isEqualToString:@"5€ Notes"]) + { + [cell setAccessoryView: [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"icon_delete"]]]; + } } - return cell; } diff --git a/TODO b/TODO index 58e5703..0680de9 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,4 @@ --Implement sensors and status options --Maintenance UITableViewCell with 2 UILabels +-Implement sensors options -Make changes to DUREX Vendor Control Project -Implement Navigation Controller -Implement table inside UITableViewCell