ios - 如何在 objective-c 中按下条形按钮时隐藏键盘

标签 ios objective-c

当用户单击栏按钮(如图所示)时,如何隐藏键盘。 如何让键盘在点击导航栏中的侧面菜单图标时退出?

enter image description here

最佳答案

objective-C :

[[UIApplication sharedApplication] sendAction:@selector(resignFirstResponder) to:nil from:nil forEvent:nil];

swift 3.0:

UIApplication.shared.sendAction(#selector(resignFirstResponder), to: nil, from: nil, for: nil)

关于ios - 如何在 objective-c 中按下条形按钮时隐藏键盘,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45834883/

相关文章:

iphone - UITextView 自定义自动补全

ios - 每当圆形图像与 Xcode 中的 CGRect 相交时发出

ios - 如何在 Mac 上运行 vmware .vmx?

iphone - 按字典键对可变数组进行排序

ios - 从纵向 View Controller 呈现模态横向 View Controller

ios - iOS 应用程序沙箱中的默认文件

ios - 删除与 iOS 中的模式匹配的文件

ios - 检测 UICollectionView 上的所有触摸

ios - 预期标识符或 ´(´ 括号错误 (?)

ios - 你如何使用 Storyboard引用 UISearchController