NSOutlineView with NSTreeController bindings with core data

痞子三分冷 提交于 2019-12-10 12:24:16

问题


Please send me some links on how to use NSOutlineView with NSTreeController bindings with using core data.

https://www.dropbox.com/s/em7kxjqmxqjto88/outlineViewCoreData%20copie.zip?dl=0 this example is ok

https://www.dropbox.com/s/1asg3kkf9ltwj2w/outlineViewCoreData.zip?dl=0 this example is ko. ==> why

the entity EntityCategory is not key value coding-compliant for the key "category".


回答1:


I have found the solution

All is ok

https://www.dropbox.com/s/nnh0e0atwmrqpmm/outlineViewCoreDataOK.zip?dl=0

i have add

extension EntityCategory {

    @objc var  children : NSSet {
        return []
    }

    @objc var count : Int {
        return 0
    }

    @objc var isLeaf : Int {
        return 1
    }

}

and

extension EntityAffectation {

    @objc var  children : NSSet {
        return category!
    }

    @objc var count : Int {
        return category!.count
    }

    @objc var isLeaf : Int {
        return 0
    }

}

and

tree controller keyPaths



来源:https://stackoverflow.com/questions/48111823/nsoutlineview-with-nstreecontroller-bindings-with-core-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!