CALayer - Place sublayer below storyboard UIButtons?

ε祈祈猫儿з 提交于 2019-12-03 22:10:49

The button layers are all sublayers of the main view's layers. You'll need to put your camera preview layer below the button's layers. Try this:

// put it behind all other subviews
[self.view.layer insertSublayer:captureVideoPreviewLayer atIndex:0];

// or, put it underneath your buttons, as long as you know which one is the lowest subview
[self.view.layer insertSublayer:captureVideoPreviewLayer below:lowestButtonView.layer];

Just to add. You can raise any subclass of UIView up in the layer by calling UIView method bringSubviewToFront.

[self.view bringSubviewToFront:self.desiredButton];
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!