当用户按下搜索按钮时,UISeachBar会检测到 [英] UISeachBar detect when user press Search button

查看:107
本文介绍了当用户按下搜索按钮时,UISeachBar会检测到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在 UISearchBar 中的键盘中单击搜索按钮时收到通知,其中包含:

I try to get notification when the Search button is clicked in the keyboard in the UISearchBar with this :

    - (BOOL)textFieldShouldReturn:(UITextField *)textField{

        return YES;
    }

但按下搜索按钮时,此方法不会调用。

But this method won't call when I press the Search button.

推荐答案

您是否尝试过此委托

Objective-C:

Objective-C:

- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar

Swift:

func searchBarSearchButtonClicked(searchBar: UISearchBar)

请参阅任何搜索栏代表的文档。
https://developer.apple.com/documentation/uikit/uisearchbardelegate

See the documentation for any searchbar delegates. https://developer.apple.com/documentation/uikit/uisearchbardelegate

这篇关于当用户按下搜索按钮时,UISeachBar会检测到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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