我有一个UIView
(称为superview),其中包含另一个UIView
(称为subview)。
我想添加一个CALayer
,使其在我的superview上可见,但在我的subview下方。
换句话说,我的subview的背景应该覆盖该层。
我查看了addLayer:below:
等内容,但不确定如何使用它。
谢谢。
编辑:我的错,我在superview和subview之间有另一个视图,并且我弄混了。谢谢大家!
我有一个UIView
(称为superview),其中包含另一个UIView
(称为subview)。
我想添加一个CALayer
,使其在我的superview上可见,但在我的subview下方。
换句话说,我的subview的背景应该覆盖该层。
我查看了addLayer:below:
等内容,但不确定如何使用它。
谢谢。
编辑:我的错,我在superview和subview之间有另一个视图,并且我弄混了。谢谢大家!
[self.view.layer insertSublayer:CALayer below:subview.layer]
在Swift中:
self.view.layer.insertSublayer(self.avPlayerLayer, below: self.button1.layer)
self.view.layer.sublayers
中没有self.button1.layer
,那该怎么办?如果您知道答案,请告诉我。 - Dima Deplovlayer.insertSublayer(sublayer, at: 0)