사진 촬영 후 사진 사용 또는 재촬영을 선택할 수 없습니다. (After Taking Picture cannot select Use Photo or Retake)


문제 설명

사진 촬영 후 사진 사용 또는 재촬영을 선택할 수 없습니다. (After Taking Picture cannot select Use Photo or Retake)

iOS 7용 앱을 업데이트하려고 하는데 맞춤 오버레이에 문제가 있습니다. 오버레이는 내가 사진의 구도를 잡을 때 사용하는 이미지입니다(라이브 및 전체 해상도 버전을 사용하여 카메라 롤의 최종 결과 구도를 잡기). 문제는 이제 iOS 7에서 오버레이가 하단에 투명하지만 일반 "사진 찍기" 버튼에 대한 액세스를 제공하지만 어떤 이유로 "사진 사용" 또는 "다시 찍기" 버튼을 탭할 수 없다는 것입니다. 사진이 찍힌 후에 나오는 것입니다. 다음은 뷰 컨트롤러를 호출하는 코드 스니펫입니다.

‑ (IBAction)takePhoto:(UIButton *)sender {

UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = NO;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.showsCameraControls = YES;

// Overlay Creation
UIView* overlayView = [[UIView alloc] initWithFrame:picker.view.frame];
    overlayView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"PBOverlayView.png"]];
    [overlayView.layer setOpaque:NO];
    overlayView.opaque = NO;

picker.cameraOverlayView = overlayView;

[self presentViewController:picker animated:YES completion:NULL];

}

## 참조 솔루션 #### 방법 1:

Another approach could be to observe the notifications when the ImagePicker changes state and remove (or disable) your overlay when you move into the "Use Photo" screen.

‑ (void) addPhotoObservers {
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(removeCameraOverlay) name:@"_UIImagePickerControllerUserDidCaptureItem" object:nil ];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(addCameraOverlay) name:@"_UIImagePickerControllerUserDidRejectItem" object:nil ];
}

‑ (void) removePhotoObservers {
    [[NSNotificationCenter defaultCenter] removeObserver:self];
}

‑(void)addCameraOverlay {
    if (self.cameraPicker) {
        self.cameraPicker.cameraOverlayView = self.myCameraOverlayView;
    }
}

‑(void)removeCameraOverlay {
    if (self.cameraPicker) {
        self.cameraPicker.cameraOverlayView = nil;
    }
}

방법 2:

You could set User Enteraction Enabled to NO on Overlay View ;) works for me

방법 3:

Your problem: When you initialised the overlayView, you've set the frame to be the same size as that of the picker. UIView* overlayView = [[UIView alloc] initWithFrame:picker.view.frame];

Explanation: Before capturing an image, the camera buttons are in the foreground of the overlayView, so that there's no issue pressing them. After capturing an image (on the "retake/use preview page"), the overlayView is the one to be in the foreground, thus blocking the access to the buttons. I know this to be an issue on iOS7, and not sure about other versions.

Possible solutions: Since this is a native problem within Apple's UIImagePickerController, I can only think of two solutions: (1) If possible, configure the overlayView to have a shorter frame which doesn't cover the bottom of the picker; (2) If you need the overlay to cover these buttons, you still have the exhausting option of configuring self.imagePicker.showsCameraControls = NO; but then you'd have to customize ALL of the camera behaviour (you can find many examples for that on the web).

방법 4:

After taking a photo, or animation on your overlay is done, i made it work by removing the overlay from its superview.

[UIView animateWithDuration:1
                      delay:1
                    options:UIViewAnimationOptionCurveEaseOut
                 animations:^{

                 } completion:^(BOOL finished) {
                     [self.view removeFromSuperview];
                 }];

(by PorthosJonjoneswahVahano.shnnamdstorm)

참조 문서

  1. After Taking Picture cannot select Use Photo or Retake (CC BY‑SA 3.0/4.0)

#uiimagepickercontroller #ios7 #photo






관련 질문

UIImagePickerController 닫기 (Dismiss UIImagePickerController)

UIImagePickerController에서 이미지 크기 조정이 작동하지 않음 (Resizing an image from UIImagePickerController not working)

사진 촬영 후 사진 사용 또는 재촬영을 선택할 수 없습니다. (After Taking Picture cannot select Use Photo or Retake)

런타임 오류를 제공하는 UIImagePicker (UIImagePicker giving runtime error)

Swift:UIImagePickerController에서 버튼의 텍스트를 변경하는 방법은 무엇입니까? (Swift: how to change the text of buttons in UIImagePickerController?)

iOS 9에서 UIImagePickerController가 이미지를 선택하지 않음 (UIImagePickerController not picking image in iOS 9)

UIImagePNGRepresentation() 내 UIImage 회전 (UIImagePNGRepresentation() rotate my UIImage)

UIImagePickerController에서 편집 사각형을 구성할 수 있습니까? (Can we config edit rectangle in UIImagePickerController)

imagePickerController를 닫는 방법? (how to close imagePickerController?)

카메라 사용 설명/사진 라이브러리 사용 설명을 추가해도 경고가 표시되지 않음 (Not showing alert even when I add Camera Usage Description / Photo Library Usage Description)

UIImagePIcker를 통해 "JPG", "PNG" 및 "JPEG" 이미지만 선택할 수 있는 방법이 있습니까? (Is there any way by which I can select only "JPG", "PNG" and "JPEG" images through UIImagePIcker)

사진 라이브러리 Swift에 비디오 저장 (Save video in Photo Library Swift)







코멘트