自定义UISearchDisplayController的“No Results“标签和”Cancel“按钮
本文转载至 http://www.cnblogs.com/pengyingh/articles/2350154.html
- (void)searchDisplayControllerWillBeginSearch:(UISearchDisplayController *)controller {
UISearchBar *searchBar = self.searchDisplayController.searchBar;
[searchBar setShowsCancelButton:YES animated:YES];
for(UIView *subView in searchBar.subviews){
if([subView isKindOfClass:UIButton.class]){
[(UIButton*)subView setTitle:@"取消" forState:UIControlStateNormal];
}
}
}
No Results:
- (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString
{
[self filterContentForSearchText:searchString];
if ([filteredListPinYin count] == 0) {
UITableView *tableView1 = self.searchDisplayController.searchResultsTableView;
for( UIView *subview in tableView1.subviews ) {
if( [subview class] == [UILabel class] ) {
UILabel *lbl = (UILabel*)subview; // sv changed to subview.
lbl.text = @”没有结果”;
}
}
}
// Return YES to cause the search result table view to be reloaded.
return YES;
}
自定义UISearchDisplayController的“No Results“标签和”Cancel“按钮的更多相关文章
- Kotlin 第一弹:自定义 ViewGroup 实现流式标签控件
古人学问无遗力, 少壮工夫老始成.纸上得来终觉浅, 绝知此事要躬行. – 陆游 <冬夜读书示子聿> 上周 Google I/O 大会的召开,宣布了 Kotlin 语言正式成为了官方开发语言 ...
- [flask] jinja自定义filter来过滤html标签
问题描述 数据库存储了html格式的博客文章,在主页(index)显示的时候带有html标签,如何过滤掉呢? 解决方案 用jinja自定义filter过滤掉html标签 我是用的工厂函数,因此在工厂函 ...
- 更改UIsearchbar 的背景和cancel按钮(转)
修改背景 searchbar =[[UISearchBar alloc]initWithFrame:CGRectMake(,KTopBarHeight, , KTopBarHeight)]; sear ...
- 自定义JSP中的Taglib标签之四自定义标签中的Function函数
转自http://www.cnblogs.com/edwardlauxh/archive/2010/05/19/1918589.html 之前例子已经写好了,由于时间关系一直没有发布,这次带来的是关于 ...
- JAVAEE——struts2_04:自定义拦截器、struts2标签、登陆功能和校验登陆拦截器的实现
一.自定义拦截器 1.架构 2.拦截器创建 //拦截器:第一种创建方式 //拦截器生命周期:随项目的启动而创建,随项目关闭而销毁 public class MyInterceptor implemen ...
- android 自定义流布局。实现热门标签。开源库SimpleFlowLayout
前言 实际项目中需要实现一个 热门搜索 的栏目,类似下图: 由于 子项(子view) 中的文字是可变的,一行能显示的 子项 的个数也无法确定.需要支持自动换行和计算位置. 开源类库 我自己写了个 自定 ...
- 自定义ASP.NET MVC Html标签辅助方法
原文:https://blog.csdn.net/a497785609/article/details/50184779 在ASP.NET MVC中,Html辅助方法给我们程序员带来很多方便,其重要性 ...
- 自定义UISearchDisplayController中搜索到结果的cell的位置
#pragma mark - UISearchBarDelegate//当搜索文本被改变的时候调用 - (void)searchBar:(UISearchBar *)searchBar textDid ...
- JSP自定义不带属性和标签体的简单标签
1. 新建HelloTag类 2. 添加额外的Jar包 (1). 右键项目 -> Build Path -> Configure Build Path -> Libraries -& ...
随机推荐
- Excel读取导入数据库碰到的问题
1.未在本地计算机上注册“microsoft.ACE.oledb.12.0”提供程序. 下载并安装驱动:http://download.microsoft.com/download/7/0/3/703 ...
- ubuntu14.04:php7+apache2+mysql
apache2: sudo apt-get install apache2 apache2-dev service apache2 start mysql: sudo apt-get install ...
- poj2104&&poj2761 (主席树&&划分树)主席树静态区间第k大模板
K-th Number Time Limit: 20000MS Memory Limit: 65536K Total Submissions: 43315 Accepted: 14296 Ca ...
- BZOJ1922 [Sdoi2010]大陆争霸 【最短路】
题目 在一个遥远的世界里有两个国家:位于大陆西端的杰森国和位于大陆东端的 克里斯国.两个国家的人民分别信仰两个对立的神:杰森国信仰象征黑暗和毁灭 的神曾·布拉泽,而克里斯国信仰象征光明和永恒的神斯普林 ...
- You need to install the perl-doc package to use this program
You need to install the perl-doc package to use this program 解决方案:apt-get install perl-doc
- 【SPOJ687&POJ3693】Maximum repetition substring(后缀数组)
题意: n<=1e5 思路: From http://hzwer.com/6152.html 往后匹配多远 r 用ST表求lcp即可...往前 l 就把串反过来再做一下.. 但是有可能求出来的最 ...
- Codeforces Round #265 (Div. 2) C 暴力+ 找规律+ 贪心
C. No to Palindromes! time limit per test 1 second memory limit per test 256 megabytes input standar ...
- 属性font-family:Font property font-family does not have generic default
以前定义字体都是用的常用的字体,也没注意过会有这个提示,昨天在写界面的时候重新定义了一个本地没有的字体,发现会有提示. W3C的文档: font-family:<family-name>, ...
- python 获取时间 存入文件
1读文件: file_path_name = '/home/robot/bzrobot_ws/src/bzrobot/bzrobot_comm/led_show_data/'+file_name+'. ...
- scrapy的allowed_domains设置含义
设置allowed_domains的含义是过滤爬取的域名,在插件OffsiteMiddleware启用的情况下(默认是启用的),不在此允许范围内的域名就会被过滤,而不会进行爬取 但是有一个问题:像下面 ...