这是一个简单的相机模块,模块的目的在于方便多个项目管理,允许不同定制项目共用一个模块,极大提高了开发效率,降低了维护成本。
在 Podfile 中添加一行即可完成安装。
pod 'AXCameraKit'
即可完成安装。
在某个 ViewController
中导入头文件:
#import <AXCameraKit/AXCameraKit.h>
在 - (void)viewDidLoad
中加载:
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
// 可以放到子线程中异步加载
[self loadCameraVC];
}
点击屏幕就弹出相机:
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
[super touchesBegan:touches withEvent:event];
[self presentCameraVC:nil];
}
可以直接实现以下代理方法,以监听状态:
- (void)cameraDidTakePicture:(UIImage *)image{
NSLog(@"%@",image);
}
- (void)cameraDidPresented{
NSLog(@"pre");
}
- (void)cameraDidDismissed{
NSLog(@"dismiss");
}