uiimagepickercontroller 기각
-
20-09-2019 - |
문제
다음 코드가 있습니다.
SecondViewController *secondView = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
[imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera];
[imagePicker setCameraOverlayView:secondView.view];
[imagePicker setShowsCameraControls:NO];
[self presentModalViewController:imagePicker animated:YES];
내 질문은 "SecondViewController"에서 ModalViewController를 어떻게 해제 할 수 있습니까?
해결책
다음에 전화해야합니다 imagePicker
a UIImagePickerControllerDelegate
방법 secondView
.
예를 들어:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
// process message
[imagePicker dismissModalViewControllerAnimated:YES];
}
다른 팁
허용 된 답변은 더 이상 iOS7에서 작동하지 않습니다. 아래는 대신 사용해야 할 방법입니다.
다시,이 방법은 다음에 호출되어야합니다 UIImagePicker
~로부터 UIImagePickerControllerDelegate
.
-(void) imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info
{
[[picker presentingViewController] dismissViewControllerAnimated:YES completion:NULL];
}
제휴하지 않습니다 StackOverflow