开发者

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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜