通过 AVFoundation 自定義摄像机
通过 Cocoapod 安装
pod "CaptureImagePro"
效果
包含头文件 #import "SLQCameraViewController/SLQCameraViewController.h"
直接使用,通过 block 回调 image
/**
* 拍照
*/
- (void)takePhoto {
__weak typeof (self)weakSelf = self;
SLQCameraViewController *vc = [[SLQCameraViewController alloc] init];
[vc getImageBlock:^(UIImage *image, UIViewController *controller) {
weakSelf.imageView.image = image;
[controller dismissViewControllerAnimated:YES completion:nil];
}];
[self presentViewController:vc animated:YES completion:nil];
}