I am trying to reload my table view controller after inserting an item using core data. I am using storyboards to present my modal view controller and am setting the delegate of the destination view controller in prepare to segue but i believe that is the issue, as my didAddCollection method is not being triggered. I am not sure what i am missing here. i used iOS TableView Reload after dismissing modal as the base for the current code i have.
In my CCNewCollectionViewController.h
@protocol NewCollectionDelegate <NSObject>
-(void) didAddCollection;
@end
@interface CCNewCollectionViewController : UIViewController {
id delegate;
}
@property (nonatomic, retain) id <NewCollectionDelegate> delegate;
In my CCNewCollectionViewController.m
@implementation CCNewCollectionViewController
@synthesize delegate;
// save data
[self.delegate didAddCollection];
// dismiss view controller
In my CollectionTableViewController.m
@interface CollectionTableViewController () <NSFetchedResultsControllerDelegate, NewCollectionDelegate>
-(void) didAddCollection {
[self.tableView reloadData];
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
[[segue destinationViewController] setDelegate:self];
}