Cancel button on UISearchController is not working sometimes
I am facing an issue with the UISearchController in iOS 8. The problem is that whenever I am clicking on cancel button, instead of cancelling the search operation, it is bringing up the keyboard. Follow below steps to reproduce the issue -
Now, instead of dismissing the search, the keyboard is popping up for entering the text. This usually happens when I am tapping at the right half of cancel button and it can be reproduced even in standard iOS apps like Contacts app. I would like to dismiss search when cancel is tapped.
Is there any workaround for this issue?
当点击取消按钮时,您可以以编程方式将搜索栏作为第一响应者删除,这将阻止键盘弹出。
[searchController.textField resignFirstResponder];
链接地址: http://www.djcxy.com/p/44298.html