sberrevoets / SDCAlertView

The little alert that could
MIT License
1.86k stars 297 forks source link

Evaluate support to popover ActionSheet on iPad #309

Open lechuckcaptain opened 4 years ago

lechuckcaptain commented 4 years ago

Following Apple guidelines an ActionSheet should be displayed as a popover anchored to the UI item who generated it.

On iPad, UIKit requires that you display an action sheet inside a popover. Figure 2 shows an action sheet anchored to a bar button item.

More info here: https://developer.apple.com/documentation/uikit/windows_and_screens/getting_the_user_s_attention_with_alerts_and_action_sheets

See screenshot: image

sberrevoets commented 4 years ago

I wish we could do that, but last I checked this wasn't (fully) possible without using some private API. I don't recall the details, but the README cautions against this as well:

This is because iOS doesn't support UIModalPresentationStyle.Custom for adaptive presentations (such as when presenting an action sheet from a bar button item).

lechuckcaptain commented 4 years ago

Thank you for the explanation, I didn't get from the README the actual problem. To be honest I prefer the behavior of your library instead of the Apple guidelines, but since the library mimic the standard UIAlertController, I thought it was worth to track the issue.

last I checked this wasn't (fully) possible without using some private API

Do you have a branch where it's possible to see your last experiments on the topic?

sberrevoets commented 3 years ago

Apologies for the late response. I don't have a branch that demonstrates the problem as this was a couple of years ago when I first added action sheet support, and enough has changed in those years that it might be possible now.

If you're still interested in this, feel free to submit a PR!