CATransform3D 始终成为最顶层视图

发布于 2024-12-12 05:18:02 字数 679 浏览 0 评论 0原文

我正在使用 CATransform3D 转换一个 UIView 的图层。问题是我无法在其上方显示其他控件(不是此转换视图的子视图)。

例如,此代码:

[UIView flipTransitionFromView:self.standardImageView 
toView:self.flippedImageView 
duration:1.0f 
completion:NULL];    

[self.view insertSubview:flippedCloseButton aboveSubview:flippedImageView];

不起作用 - FlippedCloseButton 始终位于 FlippedImageView 后面。

flipTransitionFromView 是一种仅进行上述 3d 变换的方法。

任何如何解决它的想法都将受到高度赞赏!

编辑:

我自己通过修改视图层的 zPosition 解决了这个问题:

self.flippedCloseButton.layer.zPosition = self.flippedImageView.layer.zPosition + 1;

但是这是正确的方法吗?

安德鲁斯

I'am transforming one UIView's layer by using CATransform3D. The problem is that I can't display other controls (which are not subviews of this transformed view) above it.

For example this code:

[UIView flipTransitionFromView:self.standardImageView 
toView:self.flippedImageView 
duration:1.0f 
completion:NULL];    

[self.view insertSubview:flippedCloseButton aboveSubview:flippedImageView];

does not work - the flippedCloseButton is always behind the flippedImageView.

flipTransitionFromView is a method which merely makes the said 3d transformation.

Any ideas how to solve it are highly appreciated!

EDIT:

I kinda solved it myself by modifying the view layers' zPosition:

self.flippedCloseButton.layer.zPosition = self.flippedImageView.layer.zPosition + 1;

But is it the correct way to do this?

Andrius

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

傲影 2024-12-19 05:18:02

我遇到了类似的问题,但更改 zPosition 并没有解决它。 zPosition 用于为图层提供视角(以便当 z 较大时它看起来更小),但我认为并不意味着原谅可见性序列。

我不完全理解发生了什么,但是当多个子层出现在同一“层级别”时,“什么是可见的”问题没有明确定义。我什至让图层的一部分可见,而另一部分则不可见。

在我的例子中,我通过将必须位于超级层顶部的元素解决了这个问题。这确保了它们始终可见。

在图层和动画方面,我绝不是专业人士,但在自我教育的过程中,我制作了一个应用程序(PerspectiveTest),它解释了图层参数和透视如何协同工作的一些基础知识。可能有一些帮助:
http://itunes.apple.com/nl/app/perspectivetest/id481006743 ?mt=8

问候,
沃佩

I had a similar problem, but changing the zPosition did not solve it. The zPosition is used when giving a perspective to the layer (so that it looks smaller when z is larger), but not meant forgiving a visibility sequence I believe.

I do not fully understand what is happening, but when several sublayers are present at the same "Layer level", the question "what is visible" is not well- defined. I even had that part of a layer was visible and the other part was not.

I solved this in my case by putting the elements that have to be on top in the super layer. That ensures they are alway visible.

I am by no means a pro when it comes to Layers and animation, but in the course of educating myself, I made an App (PerspectiveTest) that explains some basics of how layer parameters and perspective work together. Might be of some help:
http://itunes.apple.com/nl/app/perspectivetest/id481006743?mt=8

Regards,
Voppe

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文