我已经在自定义相机中尝试了 UIImagePickerController,当应用程序外出或我要调用 safari 时,相机快门未打开,我使用了以下代码。
-(IBAction)cameraAction:(id)sender
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setValue:@"rear" forKey:@"rearcamera"];
[defaults synchronize];
NSLog(@"hai App %@",[defaults valueForKey:@"closeApp"]);
dispatch_async(dispatch_get_main_queue(), ^{
[cameraBut setSelected:NO];
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;
});
}