coreData relationShip

来源:互联网 发布:电子杂志app软件哪个好 编辑:程序博客网 时间:2024/06/01 16:48

使用coredata的时候,不可避免的要用到两个表之间的关系relationShip,有一对一关系,也有一对多关系,这里我要说的是关系的保存:


to one relationShip:


            let relationShip =team?.mutableSetValueForKey("relationShipName")

            relationShip?.addObject(object)//要加入的对象


to many relationShip:

            let relationShip = team?.mutableSetValueForKey("relationShipName")

            ues?.addObjectsFromArray(array)//要加入对象数组


1 0
原创粉丝点击