Search code examples
iosuiimagepickercontroller

UIImagePickerController the take photo button not work, until long press or click many times


I just want to take a picture from camera through my app. But present to the UIImagePickerController, the take photo button does't work, i can see the button is pressed style up and down.But no photo is captured.Until i long press the take button or click many times, then a photo can be captured.

in my project, the current UIViewController obey the UIImagePickerControllerDelegate and UINavigationControllerDelege. But it still does'n make a difference.

the code like this below:

UIImagePickerController *picker = [[UIImagePickerController alloc] init]; picker.delegate = self; picker.sourceType = UIImagePickerControllerSourceTypeCamera; [self presentViewController:picker animated:YES completion:nil];

I try add the code:

picker.modalPresentationStyle = UIModalPresentationCurrentContext;

it does'n work neither.

Please help me. I search for solutions many times all around, but no one can solve my problem. Thanks!


Solution

  • This question took me much time on it, but i still could not solve after debug many times. So i finally decided to custom the camera. I found a wonderful code in github website, the link is here

    anyone interested can have a look.

    Finally, i found another similar scene: https://forums.developer.apple.com/message/232522#232522