diff --git a/FMC Planner 2.xcodeproj/project.pbxproj b/FMC Planner 2.xcodeproj/project.pbxproj index 8c6f4dd..4609d24 100644 --- a/FMC Planner 2.xcodeproj/project.pbxproj +++ b/FMC Planner 2.xcodeproj/project.pbxproj @@ -18,6 +18,7 @@ E22EE9F51C9DB7B4001F5BC0 /* FMC_Planner_2UITests.m in Sources */ = {isa = PBXBuildFile; fileRef = E22EE9F41C9DB7B4001F5BC0 /* FMC_Planner_2UITests.m */; }; E2763C721CA6C8AE001E4EDA /* LSKs.plist in Resources */ = {isa = PBXBuildFile; fileRef = E2763C711CA6C8AE001E4EDA /* LSKs.plist */; }; E2763C751CA6E777001E4EDA /* ViewControllerServiceMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = E2763C741CA6E777001E4EDA /* ViewControllerServiceMenu.m */; }; + E280F3A41CA7C71500DF2A05 /* TableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E280F3A31CA7C71500DF2A05 /* TableViewController.m */; }; E28E106D1C9FF93D006E2C6B /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E28E106C1C9FF93D006E2C6B /* QuartzCore.framework */; }; E28E10711CA01EC9006E2C6B /* MENU.plist in Resources */ = {isa = PBXBuildFile; fileRef = E28E10701CA01EC9006E2C6B /* MENU.plist */; }; E28E10731CA0375F006E2C6B /* ROUTE.plist in Resources */ = {isa = PBXBuildFile; fileRef = E28E10721CA0375F006E2C6B /* ROUTE.plist */; }; @@ -66,6 +67,8 @@ E2763C711CA6C8AE001E4EDA /* LSKs.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = LSKs.plist; sourceTree = ""; }; E2763C731CA6E777001E4EDA /* ViewControllerServiceMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewControllerServiceMenu.h; sourceTree = ""; }; E2763C741CA6E777001E4EDA /* ViewControllerServiceMenu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViewControllerServiceMenu.m; sourceTree = ""; }; + E280F3A21CA7C71500DF2A05 /* TableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableViewController.h; sourceTree = ""; }; + E280F3A31CA7C71500DF2A05 /* TableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TableViewController.m; sourceTree = ""; }; E28E106C1C9FF93D006E2C6B /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; E28E10701CA01EC9006E2C6B /* MENU.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = MENU.plist; sourceTree = ""; }; E28E10721CA0375F006E2C6B /* ROUTE.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = ROUTE.plist; sourceTree = ""; }; @@ -185,6 +188,7 @@ E2A9270B1CA2FD6000606E07 /* Header */ = { isa = PBXGroup; children = ( + E280F3A21CA7C71500DF2A05 /* TableViewController.h */, E22EE9D51C9DB7B3001F5BC0 /* ViewController.h */, E227C7811C9F42AB00DE0CA4 /* ViewControllerKeyboard.h */, E227C7841C9F474100DE0CA4 /* ViewControllerScreen.h */, @@ -196,6 +200,7 @@ E2A9270C1CA2FD6D00606E07 /* Implementation */ = { isa = PBXGroup; children = ( + E280F3A31CA7C71500DF2A05 /* TableViewController.m */, E22EE9D61C9DB7B3001F5BC0 /* ViewController.m */, E227C7821C9F42AB00DE0CA4 /* ViewControllerKeyboard.m */, E227C7851C9F474100DE0CA4 /* ViewControllerScreen.m */, @@ -376,6 +381,7 @@ E227C7831C9F42AB00DE0CA4 /* ViewControllerKeyboard.m in Sources */, E2763C751CA6E777001E4EDA /* ViewControllerServiceMenu.m in Sources */, E227C7861C9F474100DE0CA4 /* ViewControllerScreen.m in Sources */, + E280F3A41CA7C71500DF2A05 /* TableViewController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/FMC Planner 2.xcodeproj/xcuserdata/Kili2.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/FMC Planner 2.xcodeproj/xcuserdata/Kili2.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index 4538c32..d276ccb 100644 --- a/FMC Planner 2.xcodeproj/xcuserdata/Kili2.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/FMC Planner 2.xcodeproj/xcuserdata/Kili2.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -6,11 +6,11 @@ + + + + diff --git a/FMC Planner 2/Base.lproj/Main.storyboard b/FMC Planner 2/Base.lproj/Main.storyboard index 26433fb..308bbc6 100644 --- a/FMC Planner 2/Base.lproj/Main.storyboard +++ b/FMC Planner 2/Base.lproj/Main.storyboard @@ -81,13 +81,99 @@ + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -960,4 +1046,7 @@ + + + diff --git a/FMC Planner 2/TableViewController.h b/FMC Planner 2/TableViewController.h new file mode 100644 index 0000000..1ae0f0d --- /dev/null +++ b/FMC Planner 2/TableViewController.h @@ -0,0 +1,16 @@ +// +// TableViewController.h +// FMC Planner 2 +// +// Created by Kilian Hofmann on 27.03.16. +// Copyright © 2016 Kilian Hofmann. All rights reserved. +// + +#import "SharedDeclerations.h" +#import + +@interface TableViewController : UITableViewController + +@property(strong, nonatomic) NSMutableArray *dataSource; + +@end diff --git a/FMC Planner 2/TableViewController.m b/FMC Planner 2/TableViewController.m new file mode 100644 index 0000000..32d3a77 --- /dev/null +++ b/FMC Planner 2/TableViewController.m @@ -0,0 +1,90 @@ +// +// TableViewController.m +// FMC Planner 2 +// +// Created by Kilian Hofmann on 27.03.16. +// Copyright © 2016 Kilian Hofmann. All rights reserved. +// + +#import "TableViewController.h" + +@implementation TableViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + + // Uncomment the following line to preserve selection between presentations. + // self.clearsSelectionOnViewWillAppear = NO; + + // Uncomment the following line to display an Edit button in the navigation + // bar for this view controller. + // self.navigationItem.rightBarButtonItem = self.editButtonItem; + if ([self.title isEqualToString:@"Manage"]) { + NSArray *temp = [[NSFileManager defaultManager] + contentsOfDirectoryAtPath:[SharedDeclerations savePathForFile:@""] + error:nil]; + + _dataSource = [[temp + filteredArrayUsingPredicate: + [NSPredicate predicateWithFormat:@"NOT (SELF BEGINSWITH %@)", + @"."]] mutableCopy]; + } +} + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +#pragma mark - Table view data source + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { + return 1; +} + +- (NSInteger)tableView:(UITableView *)tableView + numberOfRowsInSection:(NSInteger)section { + return _dataSource.count; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView + cellForRowAtIndexPath:(NSIndexPath *)indexPath { + UITableViewCell *cell = + [tableView dequeueReusableCellWithIdentifier:@"Cell" + forIndexPath:indexPath]; + + if ([self.title isEqualToString:@"Manage"]) { + NSDictionary *data = [[NSDictionary alloc] + initWithContentsOfFile:[SharedDeclerations + savePathForFile:_dataSource[indexPath + .row]]]; + cell.textLabel.text = [data valueForKey:@"MENU@LSKR1"]; + } + + return cell; +} + +// 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 + [[NSFileManager defaultManager] + removeItemAtPath:[SharedDeclerations + savePathForFile:_dataSource[indexPath.row]] + error:nil]; + [_dataSource 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 + } +} + +- (void)tableView:(UITableView *)tableView + didSelectRowAtIndexPath:(NSIndexPath *)indexPath { +} + +@end diff --git a/FMC Planner 2/ViewControllerScreen.m b/FMC Planner 2/ViewControllerScreen.m index 012493e..68abe4a 100644 --- a/FMC Planner 2/ViewControllerScreen.m +++ b/FMC Planner 2/ViewControllerScreen.m @@ -107,7 +107,6 @@ #warning EXPORT TO PMDG GOES HERE } else if ([((UILabel *)tapReg.view) .restorationIdentifier isEqualToString:@"LSKR6"]) { -#warning SERVICE MENU GOES HERE [self presentViewController: [self.storyboard diff --git a/FMC Planner 2/ViewControllerServiceMenu.h b/FMC Planner 2/ViewControllerServiceMenu.h index d47c9ea..050c736 100644 --- a/FMC Planner 2/ViewControllerServiceMenu.h +++ b/FMC Planner 2/ViewControllerServiceMenu.h @@ -7,6 +7,7 @@ // #import "SharedDeclerations.h" +#import "TableViewController.h" #import "ViewController.h" #import diff --git a/FMC Planner 2/ViewControllerServiceMenu.m b/FMC Planner 2/ViewControllerServiceMenu.m index dda52bf..cf15ffe 100644 --- a/FMC Planner 2/ViewControllerServiceMenu.m +++ b/FMC Planner 2/ViewControllerServiceMenu.m @@ -24,4 +24,9 @@ [self dismissViewControllerAnimated:YES completion:nil]; } +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + ((TableViewController *)[segue destinationViewController]).title = + segue.identifier; +} + @end