This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern NSArray *PRHArrayByMap(NSArray *inArray, id (^block)(id)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { | |
UIViewController *destination = segue.destinationViewController; | |
destination.toolbarItems = self.toolbarItems; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)viewWillAppear:(BOOL)animated { | |
[super viewWillAppear:animated]; | |
self.toolbarItems = self.navigationController.toolbarItems; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)viewDidLoad { | |
[super viewDidLoad]; | |
_stashedToolbarItemsForEditingMode = self.toolbarItems; | |
} | |
- (void)setEditing:(BOOL)editing animated:(BOOL)animated { | |
[super setEditing:editing animated:animated]; | |
if (editing) { | |
self.toolbarItems = _stashedToolbarItemsForEditingMode; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)tableView:(UITableView *)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath { | |
_isEditingIndividualRow = YES; | |
[super tableView:tableView willBeginEditingRowAtIndexPath:indexPath]; | |
} | |
- (void)setEditing:(BOOL)editing animated:(BOOL)animated { | |
[super setEditing:editing animated:animated]; | |
BOOL inEditingMode = editing && !_isEditingIndividualRow; | |
if (inEditingMode) // ...set up toolbar accordingly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)setEditing:(BOOL)editing animated:(BOOL)animated { | |
[super setEditing:editing animated:animated]; | |
if (!_isEditingIndividualRow) { | |
self.tableView.allowsMultipleSelectionDuringEditing = editing; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Initial Configuration | |
#define NUMBER_INITIAL_OBJECTS 0 | |
#define USE_PREDICATE 1 | |
#define SPLIT_INTO_SECTIONS 1 | |
// Things to try changing in the model | |
#define INSERT_OBJECTS 1 | |
#define MAX_INSERTIONS 2 | |
#define DELETE_OBJECTS 1 | |
#define EDIT_INTERVAL 0.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)trueObjectsInSection:(id <NSFetchedResultsSectionInfo>)section { | |
NSArray *objects = section.objects; | |
NSUInteger number = section.numberOfObjects; | |
if (number > objects.count) { | |
objects = [objects subArrayWithRange:NSMakeRange(0,number)]; | |
} | |
return objects; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section | |
{ | |
id <NSFetchedResultsSectionInfo> sectionInfo = [self.fetchedResultsController sections][section]; | |
return [sectionInfo numberOfObjects]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)tableView:(UITableView *)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath { | |
[super setEditing:YES animated:YES]; | |
} | |
- (void)setEditing:(BOOL)editing animated:(BOOL)animated { | |
[super setEditing:editing animated:animated]; | |
// Adjust toolbar etc. acordingly | |
} |
OlderNewer