While testing new alert
method in iOS 15(document), I just found some weird behaviors it has.
I thought it was a bug at first but it’s pretty convincing that Apple intended those behaviors for the aspect of design and user experience.
Here’s what I’ve observed. I hope this post can help some other guys who also thought it’s a bug. Let’s look into it together.
First,
There only has to be one cancel button in alert window
It means even though you add cancel button more than once, alert window shows only one button among them. It’s usually the last added button shown on the window.
Second,
Cancel button’s position is fixed
When there are 2 buttons, it’s always located at the left side of the buttons. If there’re more than 2 buttons, it always goes to the bottommost part of the buttons.
2 buttons including a cancel button
4 buttons including a cancel button
Third,
Adding destructive button always adds cancel button too
It happens no matter if you added cancel button or not. Let’s say you added just 2 buttons, destructive button and another normal button. Then alert window shows 3 buttons, not 2. It shows normal button, destructive button and a cancel button too.
I hope it was helpful!