UISearchController 中的取消按钮 [英] Cancel Button in UISearchController

查看:74
本文介绍了UISearchController 中的取消按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的项目中,我使用带有内部 UISearchControllerUITableViewController 来过滤我的 tableView 中的数据.

In my project I'm using a UITableViewController with an internal UISearchController to filter the data in my tableView.

我过滤数据没有问题,但是当我点击取消按钮UISearchControllertableView的日期> 但我找不到这个的委托方法......

I have no problem to filter the data but I need to make a date of my tableView reload when I click on the CANCEL button UISearchController but I can not find the delegate method for this ...

你能帮我理解如何解决这个问题吗?

Can you help me understand how to solve this problem?

推荐答案

你需要设置UISearchController searchBar's delegate.完成此操作后,将正确调用添加的委托方法 searchBarCancelButtonClicked:.

You need to set the UISearchController searchBar's delegate. Once you have done this, the addition of the delegate method searchBarCancelButtonClicked: will properly be called.

self.searchController.searchBar.delegate = self;

- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar {
}

这篇关于UISearchController 中的取消按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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