源码简介
这是一个简单的自定义相机,LLsimpleCamera控件可以实现类似snapchat的相机屏幕,可以轻松捕捉图像、处理位置和闪光,并隐藏与开发者相关的细节。
源码运行截图
源码片段
- - (void)snapButtonPressed:(UIButton *)button {
- [self.camera capture];
- }
- /* camera delegates */
- - (void)cameraViewController:(LLSimpleCamera *)cameraVC didCaptureImage:(UIImage *)image {
- // we should stop the camera, since we don't need it anymore. We will open a new vc.
- [self.camera stop];
- ImageViewController *imageVC = [[ImageViewController alloc] initWithImage:image];
- [self presentViewController:imageVC animated:NO completion:nil];
- }
- - (void)cameraViewController:(LLSimpleCamera *)cameraVC didChangeDevice:(AVCaptureDevice *)device {
- // device changed, check if flash is available
- if(cameraVC.isFlashAvailable) {
- self.flashButton.hidden = NO;
- }
- else {
- self.flashButton.hidden = YES;
- }
- self.flashButton.selected = NO;
- }