iPhone - Mirroring back a picture taken from the front camera

前端 未结 8 2065
半阙折子戏
半阙折子戏 2020-12-24 04:06

When using the front camera of the iPhone 4 to take a picture, the taken picture is mirrored compared with what you see on the iPhone screen. How may I restore the \"on scre

8条回答
  •  误落风尘
    2020-12-24 04:32

    I'd like to vote up @Lucas Eduardo , I have tried to integrate the component LEImagePickerController into my project as below:

    - (void)onCamera:(id)sender {
        UIImagePickerController* imagePicker = [[UIImagePickerController alloc] init];
        imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
        imagePicker.cameraDevice = UIImagePickerControllerCameraDeviceFront;
        imagePicker.delegate = self;
    
        //cover the switch button at the top right corner, I just need user take photo with the front facing camera
        UIView* view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
        view.center = CGPointMake(CGRectGetWidth(imagePicker.view.bounds) - CGRectGetWidth(view.bounds)/2, CGRectGetHeight(view.bounds)/2);
        view.backgroundColor = [UIColor blackColor];
        [imagePicker.view addSubview:view];
    
        LEMirroredImagePicker* mirrorFrontPicker = [[LEMirroredImagePicker alloc] initWithImagePicker:imagePicker];
        [mirrorFrontPicker mirrorFrontCamera];
    
        [self presentViewController:imagePicker animated:YES completion:nil];
    }
    

提交回复
热议问题