coreData初步认识
来源:互联网 发布:淘宝开店必须要交钱吗 编辑:程序博客网 时间:2024/06/14 06:47
coreData初步认识
根据这片文档可以自己初步建立一个coreData,进行简单的数据的增删改查。
1、新建工程,记得勾选Use Core Data
2、建立好以后可以看到xxx.xcdatamodeld,在这里可以添加实体和实体的属性。需要注意的是:实体名字必须以大写开头。
3、然后新建一个file,记得是NSManagedObject cubclass
4、勾选自己建立的工程
5、勾选建立的实体
6、next以后我们就可以看到建立好的实体是有4个文件,如图一
这里需要注意的是,xcode7以后建立的都是4个,而7以前的是两个,如图二
解释如下:So as you can see now all properties are in a separate file with category (CoreDataProperties). Later if you generate NSManagedObject subclass for the same model Xcode 7 will regenarete only 2 files with category (DBUser+CoreDataProperties.h and DBUser+CoreDataProperties.m) to update all properties from your model but it will not make any changes to 2 other files (DBUser.h and DBUser.m) so you can use these 2 files to add there some custom methods or properties etc.
In previous version Xcode generated always only 2 files (DBUser.h and DBUser.m) and it put properties there so you could not easily modify these files because your custom implementation was deleted everytime you regenerated your subclasses. Therefore it was a common practice to manually create a category and put your methods in your category which was oposite to what we can see in Xcode 7. That however had many disadvantages because we had to use a category for implementation of our methods which does not allow to do certain things and now we can easily modify the main interface and implementation files which allows us to do anything with it. Hurray!
图一
7、
查询结果
删除后再进行查,查询结果:
改完后的结果:
至此,完成。
这里知识coredata的初步认识,具体的增删改查还需要和自己的项目结合。
- coreData初步认识
- coreData初步认识
- coredata初步学习认识(个人觉得很不错)
- 认识CoreData-初识CoreData
- Coredata第一课 认识coredata
- Coredata第一课 认识coredata
- 认识CoreData—初识CoreData
- 认识CoreData—初识CoreData
- CoreData的初步理解
- CoreData的认识
- 认识CoreData-基础使用
- 认识CoreData-使用进阶
- 认识CoreData-高级用法
- 认识CoreData-多线程
- 认识CoreData—多线程
- 认识CoreData-使用进阶
- 认识CoreData-高级用法
- 认识CoreData—多线程
- 我是如何成为一个Java Web开发者的
- PHP 修改数据库配置
- Kali Linux 网络扫描秘籍 第五章 漏洞扫描
- oracle 通过脚本创建dbLink
- javadoc生成word接口文档
- coreData初步认识
- Servlet学习笔记(三)之HttpServletResponse
- C++编程入门系列之四十七(多态性:运算符重载为类的友元函数)
- 八大排序 -- 交换排序之【冒泡排序】
- SQL(十四)-连接表
- JFreeChart使用
- INFORMATION_SCHEMA.INNODB_LOCKS
- kafka offset查询、提交
- java学习笔记之单链表的插入和删除