Pitfall: Using UIActionSheet (or UIAlertController) and First Tap Does Not Work
There is constantly bug with
Symptoms: Tapping on the action sheet does not work on the first tap. The subsequent tap works as expected.
Since long ago..
Back in 2009, UIActionSheet has a strange behaviour, whereby the tap area seems to have moved.
Solutions such as using
showFromTabBar or show in window helped to solve Apple’s bug.
It wasn’t a good experience to have such glaring UI bug in Apple’s SDK.
In iOS 8, Apple introduced
I have once again encountered strange behaviour, whereby I need to tap twice before I can tap a button on the action sheet.
Turned out the issue lies with my
UITextField, which was the first responder before I present the action sheet.
When I present the action sheet, UIKit will dismiss the keyboard, then present the action sheet. But it didn’t do so properly. The first tap will somehow be ignored.
Before presenting the action sheet, manually