我在我的故事板中有一个视图控制器,其中有几个UIButtons。 其中一个按钮激活了在子层中显示的AVFoundation相机预览图层:
captureVideoPreviewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:session];
captureVideoPreviewLayer.frame = self.view.bounds;
[self.view.layer addSublayer:captureVideoPreviewLayer];
除了预览图层在我的按钮上方渲染,以至于尽管按钮仍然可点击,但用户看不到它们的情况外,这个功能运行得很正常。有没有一种简单的方法将子层放在按钮下面?或者将按钮升高在该层中的一种简单方法?非常感谢!
[self.view.layer insertSublayer:captureVideoPreviewLayer below:lowestButtonView.layer];
在我的情况下工作得更好。 - air_bob