4.
3.数据持久化(ToDo:写程序)
-属性列表
-对象归档
-数据库SQLite3
-CoreData
2.多线程 ①NSThread ②NSOperation ③GCD (Grand Central Dispatch)
•不用自己创建 系统自带的队列
- dispatch_get_global_queue(DISPATCH_QUEUE_PROIRITY_DEFAULT,0) 替换:HIGH,LOW
- dispatch_get_main_queue
•等一组线程都结束 才会执行操作
dispatch_group_async(group, queue, block^{
.......
dispatch_group_notify(group, dispatch_get_main_queue(), ^{
finished;
});
});
group: dispatch_group_t group = dispatch_group_create;
queue: dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
•1结束才执行2,2结束才能执行3
dispatch_async(queue,block^{
dispatch_async(queue,block^{});
dispatch_barrier_async(queue, block^{});
dispatch_async(queue,^{});
});
queue: dispatch_queue_t queue = dispatch_queue_create("note", DISPATCH_QUEUE_CONCURRENT);
1.NSAarry
•如何删重
NSArray *a;
NSSet *unique = [NSSet setWithArray:a];
NSArray *b = [[NSArray alloc] initWithArray:[unique allObjects]];