Reputation: 4079
I'm creating an app that inserts values to a tableview. I also want to add the timestamp on when the value is added to the table. The scenario would be this:
Upvotes: 0
Views: 1402
Reputation: 11
(NSString *)dataFilePath {
NSArray *paths = NSSearchPathForDirectoriesInDomains(
NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
return [documentsDirectory stringByAppendingPathComponent:kFilename];
}
(void)applicationWillTerminate:(NSNotification *)notification {
NSMutableArray *array = [[NSMutableArray alloc] init];
[array addObject:field1.text];
[array addObject:field2.text];
[array addObject:field3.text];
[array addObject:field4.text];
[array writeToFile:[self dataFilePath] atomically:YES];
[array release];
}
Upvotes: 1
Reputation: 2918
Depending on how large your data is, you can store it in a plist, or sqlite3. Here's a link that might be useful: http://www.bogotobogo.com/XcodeSDK-Chapter10.html
Upvotes: 0