Is there any technical/conceptual reason why iOS does not support Cocoa Bindings? [closed]

泄露秘密 提交于 2019-11-27 12:45:38

问题


Cocoa for Mac OS X support Cocoa Binding technology, reducing need of glue code between your views and your models.

Recreating Cocoa Bindings on top of KVC on KVO seems doable with the help from cocotron source code.

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).


回答1:


Bindings on the desktop requires:

  1. All suitable UI components to expose bindings for their important properties
  2. Implementation of NSArrayController infrastructure for handling selection

On iOS, point 2 becomes less of an issue. It is rare (and perhaps even a bad UI design) to have a master-detail view layout where multiple selection is possible. This is where NSArrayController really comes into its own.

Bindings for a UITableView become less practical as the current NSArrayController design doesn't stretch to multiple sections, titles etc.

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.



来源:https://stackoverflow.com/questions/4706247/is-there-any-technical-conceptual-reason-why-ios-does-not-support-cocoa-bindings

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