UIPopover view from UIActionSheet

My problem is pretty simple, but I can not find it. When I click a button, I present a UIActionSheet with two options (library / camera). When users click a button on a UIActionSheet, I present the UIPopoverController with the photo library or the default camera.

When the button on the action bar is pressed, I get the following warning in the console:

Warning: Attempt to present <UIImagePickerController: 0x17ae1600> on <MyViewController: 0x17a3ca00> which is already presenting <UIAlertController: 0x1884acb0>

Any ideas on a suitable workaround?

+5
source share
2 answers

I found this to happen on iOS8. I presented a popover from actionSheet:clickedButtonAtIndex: The solution for me was to use actionSheet:didDismissWithButtonIndex:

+16
source

I suggest waiting until the UIActionSheet is hidden before the presentation of another view controller. Therefore, move the code representing the new view controller from the actionSheet: clickedButtonAtIndex: method to another method and call it asynchronously, for example, something like [self performSelector:@selector(presentImagePicker) withObject:nil afterDelay:1.0];

A 1 second delay allows you to hide the action table before another view controller is presented.

0
source

Source: https://habr.com/ru/post/1203925/


All Articles