2
AVCaptureVideoPreviewLayer에 UIButton 또는 다른 유형의 버튼을 추가하고 싶습니다. 여기 AVCaptureVideoPreviewLayer에 UIButton을 추가 하시겠습니까?
내가 시도 것입니다 :[self.view.layer addSublayer:_videoPreviewLayer];
UIButton * sButton = [[UIButton alloc] initWithFrame:CGRectMake(10, 0, 300, 100)];
[sButton setBackgroundColor:[UIColor yellowColor]];
[sButton setTitle:@"Stop" forState:UIControlStateNormal];
[sButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[_videoPreviewLayer addSublayer:sLabel.layer];
[_captureSession startRunning];
가 나는 또한 추가 된있는 UIView와 비슷한 시도는 AVCapture가 시작되지 않은 경우에도. 그러나 그 뷰에 하위 뷰를 추가 할 수는 없습니다.
왜 videoPreviewLayer의 containerView.layer의 버튼을 추가하지 마십시오? – Chris
그럴 수 있습니다. 어떻게해야합니까? videoPreviewLayer.containerview.layer가 존재하지 않습니다. – DCIndieDev