//theme info // listTableView.backgroundColor = [UIColor blackColor];
// Register for application exiting information so we can save data [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillTerminate:) name:UIApplicationWillTerminateNotification object:nil];
// Uncomment the following line to display an Edit button in the navigation bar for this view controller. self.navigationItem.leftBarButtonItem = self.editButtonItem; }
// this adds a navication bar to the noteDetailViewController UINavigationController *addNavCon = [[UINavigationController alloc] initWithRootViewController:noteDetailViewControler]; noteDetailViewControler.noteArray = self.Notes;
// Customize the number of rows in the table view. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [self.Notes count]; }
// Customize the appearance of table view cells. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
// this adds a navication bar to the noteDetailViewController UINavigationController *addNavCon = [[UINavigationController alloc] initWithRootViewController:noteDetailViewControler]; noteDetailViewControler.Notedict = [self.Notes objectAtIndex:indexPath.row]; noteDetailViewControler.noteArray = self.Notes;
/* // 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. // Delete the row from the data source. [self.Notes removeObjectAtIndex:indexPath.row]; [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject: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; } */
- (void)createEditableCopyOfDatabaseIfNeeded { // First, test for existence - we don't want to wipe out a user's DB NSFileManager *fileManager = [NSFileManager defaultManager]; NSString *documentDirectory = [self applicationDocumentsDirectory]; NSString *writableDBPath = [documentDirectory stringByAppendingPathComponent:@"NotesList.plist"];
BOOL dbexits = [fileManager fileExistsAtPath:writableDBPath]; if (!dbexits) { // The writable database does not exist, so copy the default to the appropriate location. NSString *defaultDBPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"NotesList.plist"];
NSError *error; BOOL success = [fileManager copyItemAtPath:defaultDBPath toPath:writableDBPath error:&error]; if (!success) { NSAssert1(0, @"Failed to create writable database file with message '%@'.", [error localizedDescription]); } } }