当用户点击视图时,取消UISearchBar [英] Cancel out of UISearchBar when user taps on view

查看:92
本文介绍了当用户点击视图时,取消UISearchBar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您点击搜索文本框下方和键盘上方时,是否有人知道如何从UISearchBar中取消(重新签名First Responder)?任何人都可以帮助发布一些代码来处理这个吗?

Does anyone know how to cancel (resign First Responder) out of a UISearchBar when you tap below the search text box and above the keyboard? Can anyone help post some code to handle this?

谢谢

推荐答案

我从 iphonedevbook 获得的另一个想法,示例代码项目04,是使用一个大的透明按钮,谎言在所有其他控件之后,如果点击则只会辞职所有第一响应者。即如果用户点击没有更重要控件的地方 - 这是直观的行为 - 搜索栏和键盘就会消失。

An alternative idea I got from iphonedevbook, sample code project 04, was to use one big transparent button that lies behind all other controls which does nothing but resign all first responders if tapped. I.e. if the user taps anywhere where there isn't a more important control - which is the intuitive behavior - the search bar and keyboard disappear.

这篇关于当用户点击视图时,取消UISearchBar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆