自定义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 -& ...
随机推荐
- python3--__call__拦截调用
__call__拦截调用 当实例调用时,使用__call__方法.不,这不是循环定义:如果定义了,Python就会为实例应用函数调用表达式运行__call__方法.这样可以让类实例的外观和用法类似于函 ...
- [android开发篇] api demo 官网学习网址
http://www.android-doc.com/resources/samples/wifidirectdemo/index.html
- 虚拟机安装centos6.5
最近想搞一下代码覆盖率的jacoco,需要在linux环境下部署一套jenkins.故需要装一个centos的虚拟机. 一.安装虚拟机. 下载后安装一个虚拟机,我选择的是VMware虚拟机 二.安装c ...
- mybatis学习(一)——mybatis简介
1.简介 MyBatis 本是apache的一个开源项目iBatis, 2010年这个项目由apache software foundation 迁移到了google code,并且改名为MyBati ...
- uva 10090 二元一次不定方程
Marbles Input: standard input Output: standard output I have some (say, n) marbles (small glass ball ...
- SHoj A序列
A序列 发布时间: 2017年7月9日 18:17 最后更新: 2017年7月9日 21:05 时间限制: 1000ms 内存限制: 128M 描述 如果一个序列有奇数个正整数组成,不妨令 ...
- 【shell】shell编程(二)-运算符
上篇我们学会了如何使用及定义变量.按照尿性,一般接下来就该学基本数据类型的运算了. 没错,本篇就仍是这么俗套的来讲讲这无聊但又必学的基本数据类型的运算了. 基本数据类型运算 操作符 符号 语义 描述 ...
- Codeforces Round #288 (Div. 2) E. Arthur and Brackets [dp 贪心]
E. Arthur and Brackets time limit per test 2 seconds memory limit per test 128 megabytes input stand ...
- Perl语言入门--4--函数
1.chop函数:删除标量变量或数组中每个字符的最后一个字 举个栗子: #!/usr/bin/perl $v = 'Flowers'; $r = chop($v); print "$v (w ...
- Myeclipse 2014 for mac10.9 激活
网上查了N多激活,都无法正确激活.后来慢慢爬文,终于激活了...真艰难啊. 所以怒马一份! 安装myeclipse. 安装完成别急着打开. 在终端里面打开的破解文件jar. java -jar ...