From ca18dfb4f7016d2e79528b4e5ee5d4f8f87093d8 Mon Sep 17 00:00:00 2001 From: charles Date: Thu, 8 Oct 2015 14:48:59 -0400 Subject: [PATCH 1/4] initial storyboard setup --- MarsWater/MarsWater.xcodeproj/project.pbxproj | 12 +++ .../MarsWater/Base.lproj/Main.storyboard | 82 ++++++++++++++- .../TaskCreationTableViewController.h | 13 +++ .../TaskCreationTableViewController.m | 99 +++++++++++++++++++ .../MarsWater/TasksTableViewController.h | 13 +++ .../MarsWater/TasksTableViewController.m | 98 ++++++++++++++++++ 6 files changed, 313 insertions(+), 4 deletions(-) create mode 100644 MarsWater/MarsWater/TaskCreationTableViewController.h create mode 100644 MarsWater/MarsWater/TaskCreationTableViewController.m create mode 100644 MarsWater/MarsWater/TasksTableViewController.h create mode 100644 MarsWater/MarsWater/TasksTableViewController.m diff --git a/MarsWater/MarsWater.xcodeproj/project.pbxproj b/MarsWater/MarsWater.xcodeproj/project.pbxproj index a2f82e3..93db8bb 100644 --- a/MarsWater/MarsWater.xcodeproj/project.pbxproj +++ b/MarsWater/MarsWater.xcodeproj/project.pbxproj @@ -7,6 +7,8 @@ objects = { /* Begin PBXBuildFile section */ + 42C49A641BC6F01900CD143F /* TaskCreationTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 42C49A631BC6F01900CD143F /* TaskCreationTableViewController.m */; settings = {ASSET_TAGS = (); }; }; + 42C49A6A1BC6F1A000CD143F /* TasksTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 42C49A691BC6F1A000CD143F /* TasksTableViewController.m */; settings = {ASSET_TAGS = (); }; }; 8DA86CA91BC1AE57006C50BC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DA86CA81BC1AE57006C50BC /* main.m */; }; 8DA86CAC1BC1AE57006C50BC /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DA86CAB1BC1AE57006C50BC /* AppDelegate.m */; }; 8DA86CB21BC1AE57006C50BC /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8DA86CB01BC1AE57006C50BC /* Main.storyboard */; }; @@ -22,6 +24,10 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 42C49A621BC6F01900CD143F /* TaskCreationTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TaskCreationTableViewController.h; sourceTree = ""; }; + 42C49A631BC6F01900CD143F /* TaskCreationTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TaskCreationTableViewController.m; sourceTree = ""; }; + 42C49A681BC6F1A000CD143F /* TasksTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TasksTableViewController.h; sourceTree = ""; }; + 42C49A691BC6F1A000CD143F /* TasksTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TasksTableViewController.m; sourceTree = ""; }; 8DA86CA41BC1AE57006C50BC /* MarsWater.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MarsWater.app; sourceTree = BUILT_PRODUCTS_DIR; }; 8DA86CA81BC1AE57006C50BC /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 8DA86CAA1BC1AE57006C50BC /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; @@ -82,6 +88,10 @@ 8DA86CD31BC1B8E4006C50BC /* ListsTableViewController.m */, 8DA86CD51BC1B904006C50BC /* ListCreationTableViewController.h */, 8DA86CD61BC1B904006C50BC /* ListCreationTableViewController.m */, + 42C49A621BC6F01900CD143F /* TaskCreationTableViewController.h */, + 42C49A631BC6F01900CD143F /* TaskCreationTableViewController.m */, + 42C49A681BC6F1A000CD143F /* TasksTableViewController.h */, + 42C49A691BC6F1A000CD143F /* TasksTableViewController.m */, 8DA86CB01BC1AE57006C50BC /* Main.storyboard */, 8DA86CB61BC1AE57006C50BC /* Assets.xcassets */, 8DA86CB81BC1AE57006C50BC /* LaunchScreen.storyboard */, @@ -188,6 +198,8 @@ 8DA86CB51BC1AE57006C50BC /* MarsWater.xcdatamodeld in Sources */, 8DA86CAC1BC1AE57006C50BC /* AppDelegate.m in Sources */, 8DB2F6EA1BC1E75500E58E65 /* Task+CoreDataProperties.m in Sources */, + 42C49A6A1BC6F1A000CD143F /* TasksTableViewController.m in Sources */, + 42C49A641BC6F01900CD143F /* TaskCreationTableViewController.m in Sources */, 8DA86CD41BC1B8E4006C50BC /* ListsTableViewController.m in Sources */, 8DB2F6E71BC1E75500E58E65 /* List.m in Sources */, 8DB2F6E91BC1E75500E58E65 /* Task.m in Sources */, diff --git a/MarsWater/MarsWater/Base.lproj/Main.storyboard b/MarsWater/MarsWater/Base.lproj/Main.storyboard index 13ead89..b45eff5 100644 --- a/MarsWater/MarsWater/Base.lproj/Main.storyboard +++ b/MarsWater/MarsWater/Base.lproj/Main.storyboard @@ -26,7 +26,7 @@ - + + + + @@ -77,6 +80,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -85,7 +128,7 @@ - + @@ -100,7 +143,7 @@ - + @@ -215,6 +258,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/MarsWater/MarsWater/TaskCreationTableViewController.h b/MarsWater/MarsWater/TaskCreationTableViewController.h new file mode 100644 index 0000000..ed3318a --- /dev/null +++ b/MarsWater/MarsWater/TaskCreationTableViewController.h @@ -0,0 +1,13 @@ +// +// TaskCreationTableViewController.h +// MarsWater +// +// Created by Charles Kang on 10/8/15. +// Copyright © 2015 Michael Kavouras. All rights reserved. +// + +#import + +@interface TaskCreationTableViewController : UITableViewController + +@end diff --git a/MarsWater/MarsWater/TaskCreationTableViewController.m b/MarsWater/MarsWater/TaskCreationTableViewController.m new file mode 100644 index 0000000..b8a80ec --- /dev/null +++ b/MarsWater/MarsWater/TaskCreationTableViewController.m @@ -0,0 +1,99 @@ +// +// TaskCreationTableViewController.m +// MarsWater +// +// Created by Charles Kang on 10/8/15. +// Copyright © 2015 Michael Kavouras. All rights reserved. +// + +#import "TaskCreationTableViewController.h" + +@interface TaskCreationTableViewController () + +@end + +@implementation TaskCreationTableViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + self.navigationItem.title = @"Create Tasks"; + + // 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; +} + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +#pragma mark - Table view data source + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { +#warning Incomplete implementation, return the number of sections + return 0; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { +#warning Incomplete implementation, return the number of rows + return 0; +} + +/* +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:<#@"reuseIdentifier"#> forIndexPath:indexPath]; + + // Configure the cell... + + 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. + 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 + [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 rearranging the table view. +- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath { +} +*/ + +/* +// 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 YES; +} +*/ + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/MarsWater/MarsWater/TasksTableViewController.h b/MarsWater/MarsWater/TasksTableViewController.h new file mode 100644 index 0000000..e1255ab --- /dev/null +++ b/MarsWater/MarsWater/TasksTableViewController.h @@ -0,0 +1,13 @@ +// +// TasksTableViewController.h +// MarsWater +// +// Created by Charles Kang on 10/8/15. +// Copyright © 2015 Michael Kavouras. All rights reserved. +// + +#import + +@interface TasksTableViewController : UITableViewController + +@end diff --git a/MarsWater/MarsWater/TasksTableViewController.m b/MarsWater/MarsWater/TasksTableViewController.m new file mode 100644 index 0000000..ad79430 --- /dev/null +++ b/MarsWater/MarsWater/TasksTableViewController.m @@ -0,0 +1,98 @@ +// +// TasksTableViewController.m +// MarsWater +// +// Created by Charles Kang on 10/8/15. +// Copyright © 2015 Michael Kavouras. All rights reserved. +// + +#import "TasksTableViewController.h" + +@interface TasksTableViewController () + +@end + +@implementation TasksTableViewController + +- (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; +} + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +#pragma mark - Table view data source + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { +#warning Incomplete implementation, return the number of sections + return 0; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { +#warning Incomplete implementation, return the number of rows + return 0; +} + +/* +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:<#@"reuseIdentifier"#> forIndexPath:indexPath]; + + // Configure the cell... + + 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. + 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 + [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 rearranging the table view. +- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath { +} +*/ + +/* +// 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 YES; +} +*/ + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end From 780e982cb766b661f8fb4d52a68d140166e3d05c Mon Sep 17 00:00:00 2001 From: charles Date: Thu, 8 Oct 2015 16:46:42 -0400 Subject: [PATCH 2/4] screen is black when clicking on list item, is very choppy too. says add new task to null, will try to figure out what's going on --- MarsWater/MarsWater.xcodeproj/project.pbxproj | 7 ++ .../Base.lproj/LaunchScreen.storyboard | 4 +- .../MarsWater/Base.lproj/Main.storyboard | 117 +++++++++++++++--- .../TaskCreationTableViewController.h | 3 + .../TaskCreationTableViewController.m | 115 +++++++---------- .../MarsWater/TasksTableViewController.h | 3 + .../MarsWater/TasksTableViewController.m | 101 +++++++-------- 7 files changed, 214 insertions(+), 136 deletions(-) diff --git a/MarsWater/MarsWater.xcodeproj/project.pbxproj b/MarsWater/MarsWater.xcodeproj/project.pbxproj index 93db8bb..28d88e3 100644 --- a/MarsWater/MarsWater.xcodeproj/project.pbxproj +++ b/MarsWater/MarsWater.xcodeproj/project.pbxproj @@ -156,6 +156,7 @@ TargetAttributes = { 8DA86CA31BC1AE57006C50BC = { CreatedOnToolsVersion = 7.0.1; + DevelopmentTeam = FP79X83Q3E; }; }; }; @@ -315,10 +316,13 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; INFOPLIST_FILE = MarsWater/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.mikekavouras.MarsWater; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE = ""; }; name = Debug; }; @@ -326,10 +330,13 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; INFOPLIST_FILE = MarsWater/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.mikekavouras.MarsWater; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE = ""; }; name = Release; }; diff --git a/MarsWater/MarsWater/Base.lproj/LaunchScreen.storyboard b/MarsWater/MarsWater/Base.lproj/LaunchScreen.storyboard index 2e721e1..900bc17 100644 --- a/MarsWater/MarsWater/Base.lproj/LaunchScreen.storyboard +++ b/MarsWater/MarsWater/Base.lproj/LaunchScreen.storyboard @@ -1,7 +1,7 @@ - + - + diff --git a/MarsWater/MarsWater/Base.lproj/Main.storyboard b/MarsWater/MarsWater/Base.lproj/Main.storyboard index b45eff5..fc0528b 100644 --- a/MarsWater/MarsWater/Base.lproj/Main.storyboard +++ b/MarsWater/MarsWater/Base.lproj/Main.storyboard @@ -90,7 +90,7 @@ - + @@ -110,7 +110,7 @@ - + @@ -120,6 +120,23 @@ + + + + + + + + + + + + + + + + + @@ -162,6 +179,11 @@ + + + + + @@ -262,32 +284,93 @@ - + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + diff --git a/MarsWater/MarsWater/TaskCreationTableViewController.h b/MarsWater/MarsWater/TaskCreationTableViewController.h index ed3318a..db63ae9 100644 --- a/MarsWater/MarsWater/TaskCreationTableViewController.h +++ b/MarsWater/MarsWater/TaskCreationTableViewController.h @@ -7,7 +7,10 @@ // #import +#import "List.h" @interface TaskCreationTableViewController : UITableViewController +@property (nonatomic) List *list; + @end diff --git a/MarsWater/MarsWater/TaskCreationTableViewController.m b/MarsWater/MarsWater/TaskCreationTableViewController.m index b8a80ec..390415e 100644 --- a/MarsWater/MarsWater/TaskCreationTableViewController.m +++ b/MarsWater/MarsWater/TaskCreationTableViewController.m @@ -7,9 +7,15 @@ // #import "TaskCreationTableViewController.h" +#import "Task.h" +#import "AppDelegate.h" @interface TaskCreationTableViewController () +@property (weak, nonatomic) IBOutlet UITextField *createTaskTextField; +@property (nonatomic) Task *task; +@property (nonatomic) NSMutableOrderedSet *listTasks; + @end @implementation TaskCreationTableViewController @@ -18,82 +24,57 @@ - (void)viewDidLoad { [super viewDidLoad]; self.navigationItem.title = @"Create Tasks"; - // Uncomment the following line to preserve selection between presentations. - // self.clearsSelectionOnViewWillAppear = NO; + self.listTasks = self.list.task.mutableCopy; - // Uncomment the following line to display an Edit button in the navigation bar for this view controller. - // self.navigationItem.rightBarButtonItem = self.editButtonItem; -} - -- (void)didReceiveMemoryWarning { - [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. -} - -#pragma mark - Table view data source - -- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { -#warning Incomplete implementation, return the number of sections - return 0; -} - -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { -#warning Incomplete implementation, return the number of rows - return 0; -} - -/* -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:<#@"reuseIdentifier"#> forIndexPath:indexPath]; + [self setupNavigationBar]; - // Configure the cell... + AppDelegate *delegate = [UIApplication sharedApplication].delegate; + + self.task = [NSEntityDescription insertNewObjectForEntityForName:@"Task" inManagedObjectContext:delegate.managedObjectContext]; - 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. - 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 - [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 rearranging the table view. -- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath { +-(void)setupNavigationBar{ + + self.navigationItem.title = [NSString stringWithFormat:@"Add New Task to %@", self.list.title]; + + self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancel)]; + self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(save)]; + + self.navigationItem.rightBarButtonItem.tintColor = [UIColor lightGrayColor]; } -*/ -/* -// 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 YES; +-(void)cancel{ + + [self dismissViewControllerAnimated:YES completion:nil]; } -*/ -/* -#pragma mark - Navigation - -// In a storyboard-based application, you will often want to do a little preparation before navigation -- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { - // Get the new view controller using [segue destinationViewController]. - // Pass the selected object to the new view controller. +-(void)save{ + + // set the task properties + + self.task.taskDescription = self.createTaskTextField.text; + + if (self.task.createdAt == nil) { + + self.task.createdAt = [NSDate date]; + + }else { + + self.task.updatedAt = [NSDate date]; + } + + + // update lisk task throwing yellow flag? + + self.list.task = self.listTasks; + + AppDelegate *delegate = [UIApplication sharedApplication].delegate; + + [delegate.managedObjectContext save:nil]; + + [self dismissViewControllerAnimated:YES completion:nil]; + } -*/ @end diff --git a/MarsWater/MarsWater/TasksTableViewController.h b/MarsWater/MarsWater/TasksTableViewController.h index e1255ab..3049d70 100644 --- a/MarsWater/MarsWater/TasksTableViewController.h +++ b/MarsWater/MarsWater/TasksTableViewController.h @@ -7,7 +7,10 @@ // #import +#import "List.h" @interface TasksTableViewController : UITableViewController +@property (nonatomic) List *list; + @end diff --git a/MarsWater/MarsWater/TasksTableViewController.m b/MarsWater/MarsWater/TasksTableViewController.m index ad79430..2077a0c 100644 --- a/MarsWater/MarsWater/TasksTableViewController.m +++ b/MarsWater/MarsWater/TasksTableViewController.m @@ -7,8 +7,16 @@ // #import "TasksTableViewController.h" +#import "TaskCreationTableViewController.h" +#import +#import "AppDelegate.h" +#import "Task.h" + +@interface TasksTableViewController () + +@property (nonatomic) NSMutableOrderedSet *listTasks; +@property (nonatomic) NSFetchedResultsController *fetchedResultsController; -@interface TasksTableViewController () @end @@ -17,82 +25,75 @@ @implementation TasksTableViewController - (void)viewDidLoad { [super viewDidLoad]; - // Uncomment the following line to preserve selection between presentations. - // self.clearsSelectionOnViewWillAppear = NO; + self.navigationItem.title = self.list.title; + + [self.tableView reloadData]; + + self.tableView.backgroundColor = self.list.color; + self.tableView.backgroundView.backgroundColor = self.list.color; - // Uncomment the following line to display an Edit button in the navigation bar for this view controller. - // self.navigationItem.rightBarButtonItem = self.editButtonItem; } -- (void)didReceiveMemoryWarning { - [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. +-(void)viewDidAppear:(BOOL)animated{ + + [self.tableView reloadData]; } #pragma mark - Table view data source - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { -#warning Incomplete implementation, return the number of sections - return 0; + return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { -#warning Incomplete implementation, return the number of rows - return 0; + return self.list.task.count + ; } -/* - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:<#@"reuseIdentifier"#> forIndexPath:indexPath]; + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TaskCellIdentifier" forIndexPath:indexPath]; + + Task *task = self.list.task[indexPath.row]; - // Configure the cell... + cell.textLabel.text = task.taskDescription; + cell.backgroundColor = self.list.color; 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. +-(BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath{ + 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 - [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 rearranging the table view. -- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath { +-(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath{ + { + if (editingStyle == UITableViewCellEditingStyleDelete) { + [self.listTasks removeObjectAtIndex:indexPath.row]; + [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic]; + } + } } -*/ -/* -// 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 YES; +#pragma mark - segue + +-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{ + + UINavigationController *navController = segue.destinationViewController; + + TaskCreationTableViewController *taskCreationTVC = (TaskCreationTableViewController *)([navController viewControllers][0]); + taskCreationTVC.list = self.list; } -*/ -/* -#pragma mark - Navigation +#pragma mark - Core Data -// In a storyboard-based application, you will often want to do a little preparation before navigation -- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { - // Get the new view controller using [segue destinationViewController]. - // Pass the selected object to the new view controller. +-(void)removeObjectFromCoreDataContext:(Task *)selectedTask { + + AppDelegate *delegate = [UIApplication sharedApplication].delegate; + NSManagedObjectContext *context = delegate.managedObjectContext; + [context deleteObject:selectedTask]; + [context processPendingChanges]; + } -*/ @end From 1b8a7773967ed69e232ab671cd430364315684f1 Mon Sep 17 00:00:00 2001 From: charles Date: Fri, 9 Oct 2015 19:05:14 -0400 Subject: [PATCH 3/4] new tasks not showing on table view, keep getting null --- .../MarsWater/Base.lproj/Main.storyboard | 40 +++++----- .../TaskCreationTableViewController.m | 77 +++++++++++++++++-- .../MarsWater/TasksTableViewController.h | 13 +++- .../MarsWater/TasksTableViewController.m | 41 +++++++--- 4 files changed, 132 insertions(+), 39 deletions(-) diff --git a/MarsWater/MarsWater/Base.lproj/Main.storyboard b/MarsWater/MarsWater/Base.lproj/Main.storyboard index fc0528b..5f63a90 100644 --- a/MarsWater/MarsWater/Base.lproj/Main.storyboard +++ b/MarsWater/MarsWater/Base.lproj/Main.storyboard @@ -42,7 +42,7 @@ - + @@ -110,7 +110,7 @@ - + @@ -120,23 +120,6 @@ - - - - - - - - - - - - - - - - - @@ -280,6 +263,23 @@ + + + + + + + + + + + + + + + + + @@ -370,7 +370,7 @@ - + diff --git a/MarsWater/MarsWater/TaskCreationTableViewController.m b/MarsWater/MarsWater/TaskCreationTableViewController.m index 390415e..5e36f31 100644 --- a/MarsWater/MarsWater/TaskCreationTableViewController.m +++ b/MarsWater/MarsWater/TaskCreationTableViewController.m @@ -13,8 +13,12 @@ @interface TaskCreationTableViewController () @property (weak, nonatomic) IBOutlet UITextField *createTaskTextField; -@property (nonatomic) Task *task; + @property (nonatomic) NSMutableOrderedSet *listTasks; +@property (nonatomic) NSIndexPath *selectedTaskIndexPath; + +@property (nonatomic) Task *task; +@property (nonatomic) Task *selectedTask; @end @@ -24,9 +28,12 @@ - (void)viewDidLoad { [super viewDidLoad]; self.navigationItem.title = @"Create Tasks"; + self.createTaskTextField.text = @""; + self.listTasks = self.list.task.mutableCopy; [self setupNavigationBar]; + [self createNewTask]; AppDelegate *delegate = [UIApplication sharedApplication].delegate; @@ -34,14 +41,35 @@ - (void)viewDidLoad { } +-(void)createNewTask{ + + if (self.selectedTask == nil) { + + AppDelegate *delegate = [UIApplication sharedApplication].delegate; + + self.task = [NSEntityDescription insertNewObjectForEntityForName:@"Task" inManagedObjectContext:delegate.managedObjectContext]; + NSLog(@"new task, %@ saved", self.listTasks); + } +} + -(void)setupNavigationBar{ - self.navigationItem.title = [NSString stringWithFormat:@"Add New Task to %@", self.list.title]; + if (self.selectedTask == nil) { + + self.navigationItem.title = [NSString stringWithFormat:@"Add New Task to %@", self.list.title]; + + }else { + + self.navigationItem.title = [NSString stringWithFormat:@"Edit %@", self.selectedTask.taskDescription]; + + self.createTaskTextField.placeholder = self.selectedTask.taskDescription; + + } self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancel)]; self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(save)]; - self.navigationItem.rightBarButtonItem.tintColor = [UIColor lightGrayColor]; + } -(void)cancel{ @@ -51,6 +79,9 @@ -(void)cancel{ -(void)save{ + [self setNewTaskProperties]; + [self setSelectedTaskProperties]; + // set the task properties self.task.taskDescription = self.createTaskTextField.text; @@ -58,23 +89,53 @@ -(void)save{ if (self.task.createdAt == nil) { self.task.createdAt = [NSDate date]; + NSLog(@"%@", self.task); - }else { + } else { self.task.updatedAt = [NSDate date]; } - - // update lisk task throwing yellow flag? - - self.list.task = self.listTasks; + // self.list.task = self.listTasks; AppDelegate *delegate = [UIApplication sharedApplication].delegate; [delegate.managedObjectContext save:nil]; + self.task = nil; + self.selectedTask = nil; + [self dismissViewControllerAnimated:YES completion:nil]; } +-(void)didSelectTask:(Task *)selectedTask atIndexPath:(NSIndexPath *)indexPath{ + + self.selectedTask = selectedTask; + + self.selectedTaskIndexPath = indexPath; + + NSLog(@"selected task: %@", selectedTask); +} + +-(void)setNewTaskProperties{ + + if (self.task != nil){ + + self.task.taskDescription = self.createTaskTextField.text; + + self.task.createdAt = [NSDate date]; + } +} + +-(void)setSelectedTaskProperties{ + + if (self.selectedTask != nil) { + + self.selectedTask.taskDescription = self.createTaskTextField.text; + + self.selectedTask.updatedAt = [NSDate date]; + } +} + @end diff --git a/MarsWater/MarsWater/TasksTableViewController.h b/MarsWater/MarsWater/TasksTableViewController.h index 3049d70..dd95d9e 100644 --- a/MarsWater/MarsWater/TasksTableViewController.h +++ b/MarsWater/MarsWater/TasksTableViewController.h @@ -9,8 +9,19 @@ #import #import "List.h" -@interface TasksTableViewController : UITableViewController +@protocol TaskTableViewControllerDelegate + +@end + +@interface TasksTableViewController : UITableViewController @property (nonatomic) List *list; +//@interface TasksTableViewController : UITableViewController + +@property (nonatomic, weak)id delegate; + +@property (nonatomic) NSIndexPath *selectedTaskIndexPath; + @end + diff --git a/MarsWater/MarsWater/TasksTableViewController.m b/MarsWater/MarsWater/TasksTableViewController.m index 2077a0c..5f14a6b 100644 --- a/MarsWater/MarsWater/TasksTableViewController.m +++ b/MarsWater/MarsWater/TasksTableViewController.m @@ -15,7 +15,7 @@ @interface TasksTableViewController () @property (nonatomic) NSMutableOrderedSet *listTasks; -@property (nonatomic) NSFetchedResultsController *fetchedResultsController; +//@property (nonatomic) NSFetchedResultsController *fetchedResultsController; @end @@ -25,16 +25,14 @@ @implementation TasksTableViewController - (void)viewDidLoad { [super viewDidLoad]; + self.navigationItem.title = @"Tasks"; self.navigationItem.title = self.list.title; [self.tableView reloadData]; - self.tableView.backgroundColor = self.list.color; - self.tableView.backgroundView.backgroundColor = self.list.color; - } --(void)viewDidAppear:(BOOL)animated{ +-(void)viewWillAppear:(BOOL)animated{ [self.tableView reloadData]; } @@ -67,12 +65,25 @@ -(BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)i } -(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath{ - { - if (editingStyle == UITableViewCellEditingStyleDelete) { - [self.listTasks removeObjectAtIndex:indexPath.row]; - [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic]; - } + + if (editingStyle == UITableViewCellEditingStyleDelete) { + + Task *selectedTask = self.list.task[indexPath.row]; + [self removeObjectFromNSManagedObjectContext:selectedTask]; + + [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; + } + +} + +-(void)removeObjectFromNSManagedObjectContext:(Task *)selectedTask { + + AppDelegate *delegate = [UIApplication sharedApplication].delegate; + NSManagedObjectContext *context = delegate.managedObjectContext; + [context deleteObject:selectedTask]; + [context processPendingChanges]; + } #pragma mark - segue @@ -96,4 +107,14 @@ -(void)removeObjectFromCoreDataContext:(Task *)selectedTask { } +-(void)pushTasksCreationTableViewController{ + + UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; + + TasksTableViewController *tasksCreationVC = [storyboard instantiateViewControllerWithIdentifier:@"tasksCreationTableViewController"]; + + [self.navigationController pushViewController:tasksCreationVC animated:YES]; + +} + @end From e59a0c3fcb8587980096b1616ed31316787b6485 Mon Sep 17 00:00:00 2001 From: charles Date: Fri, 9 Oct 2015 21:18:57 -0400 Subject: [PATCH 4/4] min requirements, no bonus or extra functionality. 20+ hours for hw this week --- .../MarsWater/Base.lproj/Main.storyboard | 15 ++- MarsWater/MarsWater/List+CoreDataProperties.h | 2 +- .../ListCreationTableViewController.m | 2 + .../MarsWater/ListsTableViewController.m | 11 ++ .../TaskCreationTableViewController.m | 103 ++---------------- .../MarsWater/TasksTableViewController.h | 12 +- .../MarsWater/TasksTableViewController.m | 74 +++---------- 7 files changed, 56 insertions(+), 163 deletions(-) diff --git a/MarsWater/MarsWater/Base.lproj/Main.storyboard b/MarsWater/MarsWater/Base.lproj/Main.storyboard index 5f63a90..2387efb 100644 --- a/MarsWater/MarsWater/Base.lproj/Main.storyboard +++ b/MarsWater/MarsWater/Base.lproj/Main.storyboard @@ -42,7 +42,7 @@ - + @@ -363,7 +363,18 @@ - + + + + + + + + + + + + diff --git a/MarsWater/MarsWater/List+CoreDataProperties.h b/MarsWater/MarsWater/List+CoreDataProperties.h index 9ce8d06..ccbccbd 100644 --- a/MarsWater/MarsWater/List+CoreDataProperties.h +++ b/MarsWater/MarsWater/List+CoreDataProperties.h @@ -18,7 +18,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nullable, nonatomic, retain) NSString *title; @property (nullable, nonatomic, retain) NSDate *createdAt; @property (nullable, nonatomic, retain) id color; -@property (nullable, nonatomic, retain) NSArray *task; +@property (nullable, nonatomic, retain) NSOrderedSet *task; @end diff --git a/MarsWater/MarsWater/ListCreationTableViewController.m b/MarsWater/MarsWater/ListCreationTableViewController.m index 0ecf6e9..c54f091 100644 --- a/MarsWater/MarsWater/ListCreationTableViewController.m +++ b/MarsWater/MarsWater/ListCreationTableViewController.m @@ -31,6 +31,8 @@ - (void)viewDidLoad { self.list = [NSEntityDescription insertNewObjectForEntityForName:@"List" inManagedObjectContext:delegate.managedObjectContext]; } + + - (void)setupNavigationBar { self.navigationItem.title = @"Create new list"; diff --git a/MarsWater/MarsWater/ListsTableViewController.m b/MarsWater/MarsWater/ListsTableViewController.m index 8a2659c..be8e82c 100644 --- a/MarsWater/MarsWater/ListsTableViewController.m +++ b/MarsWater/MarsWater/ListsTableViewController.m @@ -8,6 +8,7 @@ #import #import "ListsTableViewController.h" +#import "TasksTableViewController.h" #import "AppDelegate.h" #import "List.h" @@ -72,5 +73,15 @@ - (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id) [self.tableView reloadData]; } +-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{ + + if ([segue.identifier isEqualToString:@"taskSegue"]) { + NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow]; + + TasksTableViewController *tasksTVC = segue.destinationViewController; + + tasksTVC.list = self.fetchedResultsController.fetchedObjects[indexPath.row]; + } +} @end diff --git a/MarsWater/MarsWater/TaskCreationTableViewController.m b/MarsWater/MarsWater/TaskCreationTableViewController.m index 5e36f31..cf09ded 100644 --- a/MarsWater/MarsWater/TaskCreationTableViewController.m +++ b/MarsWater/MarsWater/TaskCreationTableViewController.m @@ -10,15 +10,11 @@ #import "Task.h" #import "AppDelegate.h" -@interface TaskCreationTableViewController () +@interface TaskCreationTableViewController () @property (weak, nonatomic) IBOutlet UITextField *createTaskTextField; - @property (nonatomic) NSMutableOrderedSet *listTasks; -@property (nonatomic) NSIndexPath *selectedTaskIndexPath; - @property (nonatomic) Task *task; -@property (nonatomic) Task *selectedTask; @end @@ -28,114 +24,37 @@ - (void)viewDidLoad { [super viewDidLoad]; self.navigationItem.title = @"Create Tasks"; - self.createTaskTextField.text = @""; - - self.listTasks = self.list.task.mutableCopy; - - [self setupNavigationBar]; - [self createNewTask]; + self.listTasks = [self.list.task mutableCopy]; AppDelegate *delegate = [UIApplication sharedApplication].delegate; self.task = [NSEntityDescription insertNewObjectForEntityForName:@"Task" inManagedObjectContext:delegate.managedObjectContext]; - -} - --(void)createNewTask{ - - if (self.selectedTask == nil) { - - AppDelegate *delegate = [UIApplication sharedApplication].delegate; - - self.task = [NSEntityDescription insertNewObjectForEntityForName:@"Task" inManagedObjectContext:delegate.managedObjectContext]; - NSLog(@"new task, %@ saved", self.listTasks); - } } --(void)setupNavigationBar{ +- (IBAction)saveTask:(id)sender { - if (self.selectedTask == nil) { - - self.navigationItem.title = [NSString stringWithFormat:@"Add New Task to %@", self.list.title]; - - }else { - - self.navigationItem.title = [NSString stringWithFormat:@"Edit %@", self.selectedTask.taskDescription]; - - self.createTaskTextField.placeholder = self.selectedTask.taskDescription; - - } - - self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancel)]; - self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(save)]; - - -} - --(void)cancel{ - - [self dismissViewControllerAnimated:YES completion:nil]; -} - --(void)save{ - - [self setNewTaskProperties]; - [self setSelectedTaskProperties]; - - // set the task properties + AppDelegate *delegate = [UIApplication sharedApplication].delegate; self.task.taskDescription = self.createTaskTextField.text; + self.task.createdAt = [NSDate date]; - if (self.task.createdAt == nil) { - - self.task.createdAt = [NSDate date]; - NSLog(@"%@", self.task); - - } else { - - self.task.updatedAt = [NSDate date]; - } + [self.listTasks addObject:self.task]; - // self.list.task = self.listTasks; - - AppDelegate *delegate = [UIApplication sharedApplication].delegate; + self.list.task = self.listTasks; [delegate.managedObjectContext save:nil]; - self.task = nil; - self.selectedTask = nil; - [self dismissViewControllerAnimated:YES completion:nil]; -} + NSLog(@"please work"); --(void)didSelectTask:(Task *)selectedTask atIndexPath:(NSIndexPath *)indexPath{ - - self.selectedTask = selectedTask; - - self.selectedTaskIndexPath = indexPath; - - NSLog(@"selected task: %@", selectedTask); } --(void)setNewTaskProperties{ +- (IBAction)cancelTask:(id)sender { - if (self.task != nil){ - - self.task.taskDescription = self.createTaskTextField.text; - - self.task.createdAt = [NSDate date]; - } -} - --(void)setSelectedTaskProperties{ + [self dismissViewControllerAnimated:YES completion:nil]; - if (self.selectedTask != nil) { - - self.selectedTask.taskDescription = self.createTaskTextField.text; - - self.selectedTask.updatedAt = [NSDate date]; - } } + @end diff --git a/MarsWater/MarsWater/TasksTableViewController.h b/MarsWater/MarsWater/TasksTableViewController.h index dd95d9e..452e3c4 100644 --- a/MarsWater/MarsWater/TasksTableViewController.h +++ b/MarsWater/MarsWater/TasksTableViewController.h @@ -9,19 +9,9 @@ #import #import "List.h" -@protocol TaskTableViewControllerDelegate - -@end - -@interface TasksTableViewController : UITableViewController +@interface TasksTableViewController : UITableViewController @property (nonatomic) List *list; -//@interface TasksTableViewController : UITableViewController - -@property (nonatomic, weak)id delegate; - -@property (nonatomic) NSIndexPath *selectedTaskIndexPath; - @end diff --git a/MarsWater/MarsWater/TasksTableViewController.m b/MarsWater/MarsWater/TasksTableViewController.m index 5f14a6b..fd75433 100644 --- a/MarsWater/MarsWater/TasksTableViewController.m +++ b/MarsWater/MarsWater/TasksTableViewController.m @@ -8,15 +8,10 @@ #import "TasksTableViewController.h" #import "TaskCreationTableViewController.h" -#import #import "AppDelegate.h" #import "Task.h" -@interface TasksTableViewController () - -@property (nonatomic) NSMutableOrderedSet *listTasks; -//@property (nonatomic) NSFetchedResultsController *fetchedResultsController; - +@interface TasksTableViewController () @end @@ -25,10 +20,8 @@ @implementation TasksTableViewController - (void)viewDidLoad { [super viewDidLoad]; - self.navigationItem.title = @"Tasks"; - self.navigationItem.title = self.list.title; - - [self.tableView reloadData]; + // self.navigationItem.title = @"Tasks"; + // self.navigationItem.title = self.list.title; } @@ -54,67 +47,34 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N Task *task = self.list.task[indexPath.row]; cell.textLabel.text = task.taskDescription; - cell.backgroundColor = self.list.color; return cell; } --(BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath{ - - return YES; -} - --(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath{ - - if (editingStyle == UITableViewCellEditingStyleDelete) { - - Task *selectedTask = self.list.task[indexPath.row]; - [self removeObjectFromNSManagedObjectContext:selectedTask]; - - [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; - - } - -} - --(void)removeObjectFromNSManagedObjectContext:(Task *)selectedTask { - - AppDelegate *delegate = [UIApplication sharedApplication].delegate; - NSManagedObjectContext *context = delegate.managedObjectContext; - [context deleteObject:selectedTask]; - [context processPendingChanges]; - -} - #pragma mark - segue -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{ UINavigationController *navController = segue.destinationViewController; - TaskCreationTableViewController *taskCreationTVC = (TaskCreationTableViewController *)([navController viewControllers][0]); + TaskCreationTableViewController *taskCreationTVC = (TaskCreationTableViewController + *)([navController viewControllers][0]); taskCreationTVC.list = self.list; } -#pragma mark - Core Data +//-(BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath{ +// +// return YES; +//} --(void)removeObjectFromCoreDataContext:(Task *)selectedTask { - - AppDelegate *delegate = [UIApplication sharedApplication].delegate; - NSManagedObjectContext *context = delegate.managedObjectContext; - [context deleteObject:selectedTask]; - [context processPendingChanges]; - -} +//-(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath{ +// [self.tableView reloadData]; +// if (editingStyle == UITableViewCellEditingStyleDelete) { +// +// [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; +// +// } +//} --(void)pushTasksCreationTableViewController{ - - UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; - - TasksTableViewController *tasksCreationVC = [storyboard instantiateViewControllerWithIdentifier:@"tasksCreationTableViewController"]; - - [self.navigationController pushViewController:tasksCreationVC animated:YES]; - -} @end