swift - accessibilityPerformEscape does not dismiss UIAlertController -
i'm trying show uialertcontoller
, dismiss when voiceover user performs scrub gesture:
override func accessibilityperformmagictap() -> bool { showpopup() return true } override func accessibilityperformescape() -> bool { print("close") return true } func showpopup(){ basealert = uialertcontroller(title: "popup", message: "choose option", preferredstyle: .alert) let firstaction = uialertaction(title: "method 1", style: .default) { (alert: uialertaction!) -> void in print("one") } let secondaction = uialertaction(title: "method 2", style: .default) { (alert: uialertaction!) -> void in print("two") } let thirdaction = uialertaction(title: "method 3", style: .default) { (alert: uialertaction!) -> void in print("three") } let closeaction = uialertaction(title: "close", style: .destructive) { (alert: uialertaction!) -> void in print("close") self.accessibilityperformescape() } basealert.addaction(firstaction) basealert.addaction(secondaction) basealert.addaction(thirdaction) basealert.addaction(closeaction) basealert.accessibilityhint = "pop menu" presentviewcontroller(basealert, animated: true, completion: { self.textfield.becomefirstresponder() } ) }
the above code shows uialertcontroller
, when perform scrub gesture not react it, when alert not shown or dismissed escape gesture works.
you need add code dismiss uialertcontroller in accessibilityperformescape()
, returning true
not enough.
Comments
Post a Comment