Runtime-API

Runtime-API
Runtime-API
动态创建一个类
Runtime-API
Runtime-API
Runtime-API
Runtime-API
Runtime-API
Runtime-API
修改uitextField的占位字的颜色
Runtime-API
方法二:窥探哪个UI控件里面的有哪些东西,可以通过这个方法获取,设置的时候可以用不一样的办法设置
找UITextField内部有哪些成员变量,记查看私有的成员变量
Runtime-API
如何访问成员变量_placeholderlabel
用KVC获取
Runtime-API
Runtime-API
或者
Runtime-API


Runtime-API
数字不能直接转成对象类型的,首先将10转为指针,为什么转10可以转成功,因为指针变量就是存地址值的.可以认为10就是地址值,因为要传id类型转为id类型所以要c语言转为OC要桥接,所以可以把age设置成功,直接将10设置给了成员变量,runtime是非常底层的.


数组是可以当做指针来用的,指针也可以当做数组来用


字典转模型
Runtime-API
假设服务器返回的json数据 字典类型
Runtime-API
很多时候把字典数据转为Person模型
Runtime-API
这样效率低,所以用runtime实现
Runtime-API
方法
Runtime-API
Runtime-API
Runtime-API

Runtime-API
两个方法换掉他们的实现,在系统自带的方法上面做一些实现
Runtime-API
Runtime-API
Runtime-API
Runtime-API
Runtime-API

*如果往数组中添加Nil对象就会crash解决的办法如下
Runtime-API
Runtime-API
Runtime-API
同理字典也是一样的
Runtime-API
Runtime-API
底层类型是__NSDictionaryM
Runtime-API
Runtime-API
Runtime-API