On iOS 6.1, I am displaying a UIImagePickerController non-modally in one tab of a UITabBar.
In my init:
self.picker = [[UIImagePickerController alloc] init];
self.picker.sourceType = UIImagePickerControllerSourceTypeCamera;
self.picker.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypeCamera];
self.picker.delegate = self;
self.picker.allowsEditing = NO;
[self.view addSubview:self.picker.view];
I have implemented:
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
return;
}
Since I never called:
[picker presentViewController:(UIViewController *) animated:(BOOL) completion:^(void)completion];
I shouldn't need to call:
[picker dismissViewControllerAnimated:NO completion:nil];
But, when I press the Cancel button, the Cancel button is grayed out and the UIImagePickerController seems to lock up. Some of the controls work, like the image/video switch and the reverse camera button, but the button to take a picture is frozen.
If I go to a different tab and return to the Camera tab, the UIImagePickerController is reset and fine again. The only code executed in this case is viewWillAppear and viewDidAppear which shouldn't have anything relevant to this situation.
On iOS 7,nothing locks up when the Cancel button is pressed.
Since the UIImagePickerController is always displayed in the tab, I don't really have a need for a cancel button so how would I either:
- Hide or disable the Cancel button
- Implement imagePickerControllerDidCancel so things do not lock up