做这样的添加这些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