Is there any data binding mechanism available for iOS?

前端 未结 8 1266
执念已碎
执念已碎 2020-12-09 03:36

In .NET I just do something like DataForm.Source = Object and then magic happens. Platform routes data changes from ui fileds to object properties, does validation and so on

8条回答
  •  佛祖请我去吃肉
    2020-12-09 03:41

    The closest thing in Cocoa is 'Key-Value Observing'. In the desktop Cocoa framework you can use bindings to hook user interface elements up to underlying objects so that changes in the objects or UI elements are reflected in the other.

    Whilst Cocoa on iOS doesn't have this sort of UI bindings, you can still use 'Key-Value Observing' to synchronise changes in the data model with UI elements as described here:

    http://developer.apple.com/library/iOS/#documentation/General/Conceptual/Devpedia-CocoaApp/KVO.html

提交回复
热议问题