答案 0 :(得分:0)
从代码创建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];
您会看到此链接,例如https://github.com/anka/bw_examples