开发者

embed live camera view inside a UIView

开发者 https://www.devze.com 2023-03-31 19:28 出处:网络
I\'ve been trying to figure out how to embed a small(ish) live camera view inside of an iPhone\'s UIView to no avail.

I've been trying to figure out how to embed a small(ish) live camera view inside of an iPhone's UIView to no avail.

I have not even been able to find any samples of that on the net either. I know that it's do-able, but I don't even know where to start. There seem to be a lot of examples where others have added views TO the full-blown screen view of the camera, but not the other way around...

It seems that UIImagePickerControllerSourceTypeCamera just displays the BIG modal camera viewer, picture taker, so it is unsuitable (I think) for my purposes.

I want to have a small live camera view, inside a UIView, and I can add my own buttons for taking the pic (I can pro开发者_运维问答bably figure this out - a delegate of some sort to capture the image)

Thank you...


For your purpose you need to use AVFoundation, specifically look at AVCaptureSession , AVCaptureDeviceInput, which you can use in order to get access to the cameras and look into AVCaptureVideoPreviewLayer which will allow you to draw the camera input to the screen, everything you need is in there..

0

精彩评论

暂无评论...
验证码 换一张
取 消