做這樣的添加這些methods
使用時store temporary data
在Temp Directory
和retrieve
從中
#pragma mark
#pragma mark Data Save
// need a path
- (NSString *)getArrayPath
{
//NSString* path = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
return [NSTemporaryDirectory() stringByAppendingPathComponent:@"temp.dat"];
}
// save an array
- (void)saveVideoData:(NSMutableArray*)data
{
[NSKeyedArchiver archiveRootObject:data toFile:[self getArrayPath]];
}
// get that array back
- (NSMutableArray *)loadSavedData
{
return [NSKeyedUnarchiver unarchiveObjectWithFile:[self getArrayPath]];
}
保存的值:對於離。
//create array
NSMutableArray *arrValues = [NSMutableArray arrayWithObjects:txt1.text,txt2.text,txt3.text,nil];
[self saveVideoData:arrValues];
獲取值:例如,
NSMutableArray *arrValues = [self loadSavedData];
通過another view controller
添加上述方法ü可以得到data values
there
也。
這解決了我的問題。我想我會更頻繁地使用它!好的解決方法! – Steaphann 2013-05-08 07:41:23