如何覆盖UISearchBar中的取消按钮

编程入门 行业动态 更新时间:2024-10-09 09:23:18
本文介绍了如何覆盖UISearchBar中的取消按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我目前正在使用以下方法停止取消按钮项目显示在搜索栏中。我有一个我想要使用的自定义 UIButton 。

I am currently using the following method to stop the cancel button item from showing up in the search bar. I have a custom UIButton that I would like to use instead.

问题在于目前已构建在取消按钮仍然显示。

The problem is that at the moment the built in cancel button is still showing up.

- (void)searchDisplayControllerDidBeginSearch:(UISearchDisplayController *)controller { controller.searchBar.showsCancelButton = NO; }

感谢您的帮助

推荐答案

您可以使用此隐藏取消按钮

You can hide your cancel button using this

- (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar { [searchBar setShowsCancelButton:NO animated:YES]; }

更多推荐

如何覆盖UISearchBar中的取消按钮

本文发布于:2023-11-28 01:08:12,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1640365.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:按钮   UISearchBar

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!