• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

Core Animation学习笔记—第十节Key-Value Coding Extensions

武飞扬头像
诚是张嘉诚
帮助2

各位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
系列文章
更多 icon
同类精品
更多 icon
继续加载