自定义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 -& ...
随机推荐
- 九度oj 题目1086:最小花费
题目描述: 在某条线路上有N个火车站,有三种距离的路程,L1,L2,L3,对应的价格为C1,C2,C3.其对应关系如下: 距离s 票价 0<S<=L1 ...
- iOS NSLog各种打印
%@ 对象 %d,%i 整型 (%i的老写法) %hd 短整型 %ld , %lld 长整型 %u 无符整型 %f 浮点型和double型 %0.2f 精度浮点数,只保留两位小数 %x: 为32 ...
- Python之FTP传输
访问FTP,无非两件事情:upload和download,最近在项目中需要从ftp下载大量文件,然后我就试着去实验自己的ftp操作类,如下(PS:此段有问题,别复制使用,可以参考去试验自己的ftp类! ...
- annotation之@Autowired、@Inject、@Resource三者区别
一.@Autowired 1.@Autowired是spring自带的注解,通过‘AutowiredAnnotationBeanPostProcessor’ 类实现的依赖注入: 2.@Autowire ...
- bzoj 2017 [Usaco2009 Nov]硬币游戏 动态规划
[Usaco2009 Nov]硬币游戏 Time Limit: 10 Sec Memory Limit: 162 MBSubmit: 431 Solved: 240[Submit][Status] ...
- ifame标签
一 w3c网址 http://www.w3school.com.cn/tags/tag_iframe.asp 二 iframe 元素会创建包含另外一个文档的内联框架(即行内框架). 三 页面显示及代码 ...
- docker-nginx-标记一下
拉取nginx镜像 然后启动容器: docker run -p : --name mynginx -d -v $PWD/nginx.conf:/etc/nginx/conf.d/default.con ...
- ubuntu下用webbench做网站压力测试
安装依赖 exuberant-ctags sudo apt-get install exuberant-ctags 下载源码并安装 wget http://blog.s135.com/soft/lin ...
- HUNAN -11566 Graduation Examination(找规律)
http://acm.hunnu.edu.cn/online/?action=problem&type=show&id=11566&courseid=0 输入n,求出第n个fi ...
- P2085 最小函数值 洛谷
https://www.luogu.org/problem/show?pid=2085 题目描述 有n个函数,分别为F1,F2,...,Fn.定义Fi(x)=Ai*x^2+Bi*x+Ci (x∈N*) ...