UIAlertController dismiss is slow

喜你入骨 提交于 2019-12-06 03:49:32

I know it's an old question but I had the same problem and adding this in the ViewController presenting the UIAlertController solved it for me:

- (BOOL)canBecomeFirstResponder {
    return YES;
}

Swift version:

override func canBecomeFirstResponder() -> Bool {
    return true
}

Sadly, overriding canBecomeFirstResponder did not help us.

What did help us was to call resignFirstResponder on any possible responders in the view controller BEFORE showing the alert.

For some reason, if a text field was a first responder, it looks like it would try to go through the view hierarchy looking for the next responder. If no text fields had any focus, the delay disappeared.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!