ios - 为什么转换后的 UIView 会与层次结构中更高层的其他 View 重叠?

标签 ios objective-c cocoa-touch uiview catransform3d

我有一个 View ,我对它的图层应用了转换 - 更改了 m34 字段,在 x 轴上旋转它并在 x 和 y 上缩放它。然后我将这个 View 添加到一个更大的 super View 中。我的问题是我添加到更大的 super View 的每个其他 View 都被转换后的 View 隐藏或重叠(如果新 View 的框架与转换后的 View 的框架相交),即使新 View 在层次结构中比转换后的 View 更高新 View 被添加到更大父 View 的 subviews 数组的末尾。任何想法这种行为背后的原因是什么? :-) 非常感谢!

最佳答案

3D 转换用于制作伪 3D。在这个 3D 空间中,您的层与其他层重叠。要改变它的 z-pozition 使用 CAlayer 的属性

@property CGFloat zPosition;

The layer’s position on the z axis. Animatable. The default value of this property is 0. Changing the value of this property changes the the front-to-back ordering of layers onscreen. This can affect the visibility of layers whose frame rectangles overlap. The value of this property is measured in points.

关于ios - 为什么转换后的 UIView 会与层次结构中更高层的其他 View 重叠?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23569933/

相关文章:

ios - 当我尝试观察下一个视频的开始时 AVQueuePlayer 崩溃 : AVPlayerItem was deallocated with observers

ios - 如何根据另一个数组中的值向 NSMutableArray 添加索引?

iphone - UILabel 在第 3 代和第 4 代 iPod 上的显示方式有所不同

ios - 在SKLabelNode周围绘制边框

ios - UIView 展开到里面的内容

ios - 文件是通用的(三个切片),但它不包含 iOS 上静态库的(n)ARMv7-s 切片错误,无论如何要绕过?

iphone - 有人可以向我解释这些错误吗?

ios - 放松转场,音频继续播放

c# - iOS Row Selected 未被调用

iOs Segue 动画从左到右(水平)