gpt4 book ai didi

ios - 将多个图层剪切到一个设置的框架? (核心动画/Quartz 2d)

转载 作者:行者123 更新时间:2023-11-29 11:15:38 26 4
gpt4 key购买 nike

我不确定如何表达,也不知道正确的术语是什么。希望我能解释...

设置:

  • 基本上我有一个由多个 CALayer 组成的 UIView。
  • 每个层上都有一个对象(使用 Draw 方法覆盖自定义绘制)
  • 我使用比例变换(即:增长)制作动画,所以它不断增长,直到它扩展到超过父级框架的全部大小
  • 当每一层到达 UIView 的边缘时,我要裁剪它,所以它不会显示超过 UIView 的边界

希望这张图片可以解释我想做什么: Example image

最佳答案

clipsToBounds 属性是否关闭?来自 UIView 文档:

clipsToBounds A Boolean value that determines whether subviews are confined to the bounds of the receiver.

@property(nonatomic) BOOL clipsToBounds

Discussion Setting this value to YES causes subviews to be clipped to the bounds of the receiver. If set to NO, subviews whose frames extend beyond the visible bounds of the receiver are not clipped. The default value is NO.

您可以通过在代码中设置属性来打开它,或者如果 View 来自 xib 文件,则在 Interface Builder 的属性检查器中有一个“剪辑 subview ”复选框。

关于ios - 将多个图层剪切到一个设置的框架? (核心动画/Quartz 2d),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9593829/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com