Saving and Loading the Checklist Items
来源:互联网 发布:win10电脑无法识别网络 编辑:程序博客网 时间:2024/05/17 22:29
Saving
- (NSString *)documentsDirectory
{
NSArray *paths =NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);//asd
NSString *documentsDirectory = [paths objectAtIndex:0];
return documentsDirectory;
}
- (NSString *)dataFilePath
{
return [[selfdocumentsDirectory] stringByAppendingPathComponent:@"Checklists.plist"]; //Create new string asd/Checklists.plist
}
- (void)viewDidLoad
{
[superviewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
NSLog(@"Documents folder is %@",[selfdocumentsDirectory]);
NSLog(@"Data file path is %@", [selfdataFilePath]);
...
}
pp154
Loading
pp164
- (void)loadChecklistsItems
{
NSString *path = [selfdataFilePath];
if ([[NSFileManagerdefaultManager] fileExistsAtPath:path]) {
NSData *data = [[NSDataalloc] initWithContentsOfFile:path];
NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiveralloc] initForReadingWithData:data];
items = [unarchiver decodeObjectForKey:@"ChelistItems"];
} else {
items = [[NSMutableArrayalloc] initWithCapacity:20];
}
}
//restore For viewcontrollers that are automatically loaded from a nib or storyboard
- (id)initWithCoder:(NSCoder *)aDecoder
{
if (self = [superinitWithCoder:aDecoder]) {
[selfloadChecklistsItems];
}
return self;
}
- Saving and Loading the Checklist Items
- Adding new items to the Checklist
- weka中Saving and loading Trained models
- iOS extracts: Saving and Loading Game State
- Saving and Loading the State of Multitasking Apps(多任务应用中,状态变化的处理)
- Editing Existing Items in Checklist
- 4-3 读取和保存(Loading and Saving)
- (转)4.3加载和保存(Loading and Saving)
- !!!Obj-c on Mac --- Chapter 15 File Loading and Saving
- (转)4.3加载和保存(Loading and Saving)
- Customize the file name and saving directory
- selecting deselecting all items in checklist
- The DBA Daily Checklist
- Direct Reports and loading the component
- Break the list items Inheritance permission and custom the permission with ItemAdded Event
- Jquery PlugIn for lazy loading items.
- 【STL】Saving the Universe
- The life-saving straw
- 几种进程间的通信方式
- 网络红人潘春春写真曝光 因尺度大胆走红 秒杀宅男女神柳岩林志玲
- C 宏定义
- Effective C++实践
- json & bosn
- Saving and Loading the Checklist Items
- 浅谈C++中的友元关系
- 成功申请到ClickDealer联盟
- 对于学习效率的感想
- 测试你最真实的一面!很准的哦
- SSE 指令 gcc编译
- UNDO管理
- 单链表的基本操作
- Android实现单线程异步多文件下载的代码