作者热门文章
- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我正在以一种稍微非常规的方式使用 UISearchViewController。
我的 UISearchBar 最初是隐藏的。当用户点击按钮时,我取消隐藏 UISearchBar 并激活 UISearchViewController。我还设置了搜索栏的文本,并告诉搜索栏成为第一响应者。
问题是 UISearchDisplayController 创建的灰色叠加层仍然可见。它不会消失,除非我预设的文本被清除,并且用户开始重新输入。
self.searchDisplayController.searchBar.hidden = NO;
self.searchDisplayController.searchBar.text = @"term";
[self.searchDisplayController.searchBar becomeFirstResponder]; // this actually appears to activate everything
[self.searchDisplayController setActive: YES animated: YES]; // this activates but does not set the searchbar to 1st responder...
为什么 UISearchDisplayController 继续显示它的灰色覆盖层,我该如何清除它?
最佳答案
更改调用顺序似乎可以解决问题。不知道为什么。
[self.searchDisplayController setActive: YES animated: YES];
self.searchDisplayController.searchBar.hidden = NO;
self.searchDisplayController.searchBar.text = @"term";
[self.searchDisplayController.searchBar becomeFirstResponder];
关于ios - 如何激活具有预设期限的 UISearchDisplayController?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9608051/
我有一个 MySQL 表(其中包括)以下列: [name] [member_since_date] [member_until_date] 当某人的成员(member)资格结束时,[member_un
我是一名优秀的程序员,十分优秀!