问题描述
Cocoa for Mac OS X支持Cocoa Binding技术,减少你的视图和模型之间需要粘合代码。
Cocoa for Mac OS X support Cocoa Binding technology, reducing need of glue code between your views and your models.
在KVC上重新创建KVC的Cocoa Bindings可以在cocotron源代码的帮助下。
Recreating Cocoa Bindings on top of KVC on KVO seems doable with the help from cocotron source code.
有没有任何技术或概念上的原因,为什么Cocoa Bindings不是SDK的一部分?
我正在考虑性能,缺乏垃圾收集,缺乏来自UI元素的KVC支持(例如UISlider)。
Is there any technical or conceptual reason why Cocoa Bindings are not part of the SDK ? I'm thinking about performance, lack of garbage collection, lack of KVC support from UI elements (UISlider for instance).
推荐答案
桌面上的绑定需要:
- 所有合适的UI组件都会暴露绑定的重要属性
- 执行
NSArrayController
用于处理选择的基础设施
- All suitable UI components to expose bindings for their important properties
- Implementation of
NSArrayController
infrastructure for handling selection
NSArrayController 真的属于自己。
UITableView的绑定变得不太实用,因为当前 NSArrayController
设计不能扩展到多个部分,标题等。
Bindings for a UITableView become less practical as the current NSArrayController
design doesn't stretch to multiple sections, titles etc.
点1将是有用的。然而,它需要大量的工作,以在所有UIKit控件中实现绑定支持。我认为它永远不会成为他们实施的高优先级。
Point 1 would be useful to have. However it requires a large quantity of work by Apple to implement bindings support in all the UIKit controls. I assume it's never become a high enough priority for them to implement.
这篇关于有什么技术/概念的原因,为什么iOS不支持Cocoa Bindings?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!