将UIView的子视图放在其CALayer前面? [英] put subviews of a UIView in front of its CALayer?

查看:60
本文介绍了将UIView的子视图放在其CALayer前面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能吗?基本上,我想给UIView一个子视图,并使该子视图在视图层的前面(更具体地说,在该层的边界的前面)。

Is this possible? Basically, I want to give my UIView a subview, and have that subview be in front of the view's layer (more specifically, in front of said layer's border).

Of当然,我可以通过在视图的超级视图中创建两个子视图,一个在另一个子视图之上,来达到我想要的效果。但是,我宁愿避免这种情况。

Of course I could achieve the effect I want by making two subviews of the view's superview, one on top of the other. But I'd rather avoid that if possible.

推荐答案

我自己寻找了一段时间。我不认为有可能。正如您所暗示的,我通过将子视图和父视图添加到同一容器父视图来解决了该问题。然后,只需对两个子视图进行排序即可,以便您的子视图位于另一个视图及其边框之上。

I looked for this for a while myself; i don't believe it is possible. I solved the issue by, as you hint at, adding the subview and the parent to the same 'container' superview. Then its just a matter of ordering the two subviews, so that your subview is above the other and its border.

这篇关于将UIView的子视图放在其CALayer前面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆