博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
KVC and Scalar
阅读量:6950 次
发布时间:2019-06-27

本文共 1362 字,大约阅读时间需要 4 分钟。

https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/KeyValueCoding/DataTypes.html

The default implementation of the key-value coding protocol methods provided by NSObject work with both object and non-object properties. The default implementation automatically translates between object parameters or return values, and non-object properties. This allows the signatures of the key-based getters and setters to remain consistent even when the stored property is a scalar or a structure.

NOTE

Because all properties in Swift are objects, this section only apples to Objective-C properties.

When you invoke one of the protocol’s getters, such as valueForKey:, the default implementation determines the particular accessor method or instance variable that supplies the value for the specified key according to the rules described in . If the return value is not an object, the getter uses this value to initialize an NSNumber object (for scalars) or NSValue object (for structures) and returns that instead.

Similarly, by default, setters like setValue:forKey: determine the data type required by a property’s accessor or instance variable, given a particular key. If the data type is not an object, the setter first sends an appropriate <type>Value message to the incoming value object to extract the underlying data, and stores that instead.

转载地址:http://wecil.baihongyu.com/

你可能感兴趣的文章
tshark可以实现命令行脚本分析流量
查看>>
单例模式的使用和继承
查看>>
LVM逻辑卷管理-软RAID磁盘阵列
查看>>
LVS的三种模式区别详解
查看>>
如何隐藏xendesktop登录时domain信息的输入
查看>>
Linux_MySQL二次整理(1)
查看>>
Linux内核LTS长期支持版生命周期
查看>>
VMware下的Linux中调整屏幕大小,分辨率问题,终于解决啦
查看>>
cxgrid打印
查看>>
必 备 习 题 集 ( 三 )
查看>>
citrix桌面发布方式
查看>>
HTTP协议详解(真的很经典)
查看>>
EMC销售部全球CTO Patricia Florissi:大数据不是炒作
查看>>
判断字符串是否是合法的ipv4地址
查看>>
Linux系统手动安装rzsz 软件包
查看>>
Hyper-V安装笔记
查看>>
Golang面试题解析(二)
查看>>
Juniper SRX与思科跑IPSEC ×××+OSPF
查看>>
passwd修改用户密码
查看>>
Windows Phone(三)WP7版 " 记账本" 开发(使用SQLite数据库)
查看>>