了解iOS中的KVO [英] Understanding KVO in iOS

查看:102
本文介绍了了解iOS中的KVO的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于确保KVO合规性,
有一些似乎很难理解的官方定义

Regarding "Ensuring KVO Compliance", there are some official definition which seem like hard to understand


为了
符合特定房产的KVO标准,
a类必须确保以下内容;

In order to be considered KVO-compliant for a specific property, a class must ensure the following;


  1. class必须是符合
    的键值编码,符合确保KVC合规性中规定的

  1. The class must be key-value coding compliant for the property as specified in Ensuring KVC Compliance.

该类必须允许自动

属性的观察员通知,或实施手册
键值观察。

The class must allow automatic observer notifications for the property, or implement manual key-value observing for the property.


谁可以提供更具体的例子来说明这一点?谢谢

Who can give more specific examples to make this more clear ? Thanks

推荐答案

看看确保KVO合规性键值的自动与手动支持部分观察编程指南。合规性基本上是通过遵循方法和/或ivars的命名约定来实现的。

Take a look at Ensuring KVO Compliance the Automatic Versus Manual Support section of the Key-Value Observing Programming Guide. Compliance is essentially achieved by following naming conventions for methods and/or ivars.

根据我的经验,KVO倾向于正常工作,这很好。

In my experience KVO tends to 'just work', which is nice.

这篇关于了解iOS中的KVO的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆