Core Animation学习笔记—第十节Key-Value Coding Extensions
各位iOS开发大佬们好:
我是一名Swift SwiftUI栈的iOS小白,目前还在上大三,最近准备实习,面试的过程中发现现在大公司很多还在用OC UIKit的技术栈,OC我还在考虑要不要学,目前想先把UIKit学完,这是我在官网学习UIKit英文文档时摘录的本人认为的重点,如果你们也觉得对你们有用的话欢迎持续关注,我大概一天更一节,有事除外。格式什么的我也就不做了,翻译都是我自己翻译的,哪里不对欢迎在评论区指正,感谢各位大佬支持
今天2021年12月10日
这一章叫做Key-Value Coding Extensions
这章是附录,关于KVC的
Core Animaiton对KVO做了扩展
CAAnimation和CALAyer类是符合键值编码的容器类,这意味着您可以为任意键设置值。即使key someKey 不是 CALayer 类的声明属性,仍可按如下方式为其设置值:
layer.setValue(50,forKey:”someKey”)
取值一样
CAAnimation和CALayer类通过defaultValueForKey: 类方法设置默认值
Kvc支持结构体
CATransform3D Key Paths
You can use the enhanced key path support to retrieve specific transformation values for a property that contains a CATransform3D data type. To specify the full key path for a layer’s transforms, you would use the string value transform or sublayerTransform followed by one of the field key paths in Table C-2.
Setting values using key paths is not the same as setting them using Objective-C properties. You cannot use property notation to set transform values. You must use the setValue:forKeyPath: method with the preceding key path strings.
CGPoint Key Paths
If the value of a given property is a CGPoint data type, you can append one of the field names in Table C-3 to the property to get or set that value.
CGSize Key Paths
If the value of a given property is a CGSize data type, you can append one of the field names in Table C-4 to the property to get or set that value.
Table C-4 CGSize data structure fields
CGRect Key Paths
If the value of a given property is a CGRect data type, you can append the following field names in Table C-3 to the property to get or set that value. For example, to change the width component of a layer’s bounds property, you could write to the key path bounds.size.width.
Table C-5 CGRect data structure fields
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /boutique/detail/tanhgbjkji
-
photoshop保存的图片太大微信发不了怎么办
PHP中文网 06-15 -
Android 11 保存文件到外部存储,并分享文件
Luke 10-12 -
《学习通》视频自动暂停处理方法
HelloWorld317 07-05 -
word里面弄一个表格后上面的标题会跑到下面怎么办
PHP中文网 06-20 -
photoshop扩展功能面板显示灰色怎么办
PHP中文网 06-14 -
微信公众号没有声音提示怎么办
PHP中文网 03-31 -
excel下划线不显示怎么办
PHP中文网 06-23 -
excel打印预览压线压字怎么办
PHP中文网 06-22 -
怎样阻止微信小程序自动打开
PHP中文网 06-13 -
TikTok加速器哪个好免费的TK加速器推荐
TK小达人 10-01