可能重复:
How do you create a custom camera view, instead of UIImagePickerViewController?
App Store现在提供的许多图像共享应用都使用自定义相机,而不是Apple提供的标准相机选择器。
有没有人知道创建自定义相机的任何教程或技巧?
答案 0 :(得分:36)
是的,从代码创建UIImagePickerController,调整其属性,在其上添加叠加层,并与您的控制器一起控制您在该叠加层上的任何内容:自定义控件,叠加图像等...
这就是这样的:
self.picker = [[UIImagePickerController alloc] init];
self.picker.sourceType = UIImagePickerControllerSourceTypeCamera;
self.picker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
self.picker.cameraDevice = UIImagePickerControllerCameraDeviceRear;
self.picker.showsCameraControls = NO;
self.picker.navigationBarHidden = YES;
self.picker.toolbarHidden = YES;
self.picker.wantsFullScreenLayout = YES;
// Insert the overlay
self.overlay = [[OverlayViewController alloc] initWithNibName:@"Overlay" bundle:nil];
self.overlay.pickerReference = self.picker;
self.picker.cameraOverlayView = self.overlay.view;
self.picker.delegate = self.overlay;
[self presentModalViewController:self.picker animated:NO];
OverlayViewController
是您必须编写的控制器,用于控制您添加到叠加层中的所有内容。
pickerReference
是您可以保留向相机发送订单的属性。例如,您可以从放置在叠加层上的UIButton的IBAction中调用以下内容:
[self.pickerReference takePicture];
答案 1 :(得分:13)
对于图像处理(关于我们在评论中的讨论),您可以看一下:
http://code.google.com/p/simple-iphone-image-processing/
http://sourceforge.net/projects/photoshopframew/
https://github.com/esilverberg/ios-image-filters
http://developer.apple.com/library/ios/#samplecode/QuartzDemo/Introduction/Intro.html
http://cocoawithlove.com/2011/01/advanced-drawing-using-appkit.html