Form sheet is a modal presentation type. You change that by modifying the modalPresentationStyle
property of a view controller before presentation.
_imagePicker.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentViewController:_imagePicker animated:YES completion:nil];
However, if you read the documentation of UIImagePickerController
, you will see that Apple requires you to present the view controller inside a popover.
So:
if([_popoverController popoverVisible])
{
[_popoverController dismissPopoverAnimated:NO];
_popoverController = nil;
}
_popoverController = [[UIPopoverController alloc] initWithContentViewController:_imagePicker];
[_popoverController setDelegate:self];
[_popoverController presentPopoverFromBarButtonItem:_button permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];