How Do I Take Still Images?
i wa开发者_开发百科nt to add a camerapreviewlayer and a take photo action but i dont know how. Can someone help me. Im new in Xcode
If it's an CALayer
(which I'm pretty sure it is, but I'll verify it now), you can do this:
UIGraphicsBeginImageContext();
[yourCameraPreviewLayer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGrahpicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
Edit: I presume you're using AVCaptureVideoPreviewLayer
, then it is a CALayer
, so above should work.
Here is an example of taking a photo: https://github.com/fulldecent/FDTake
精彩评论