DJSelectCityViewController.m

/** SearchBar开始编辑 */
- (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar { // 隐藏导航栏
[self.navigationController setNavigationBarHidden:YES animated:YES]; // 显示遮罩
UIView *cover = [[UIView alloc] init];
cover.backgroundColor = [UIColor blackColor];
cover.alpha = 0.2;
cover.frame = self.cityTableView.frame;
cover.tag = DJCoverTag; // 由于UIView 不是UIControl,所以没有addTarget方法,可以使用UITapGestureRecognizer代替
// 当conver被点击时,移除第一响应者
[cover addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:searchBar action:@selector(resignFirstResponder)]]; [self.view addSubview:cover]; } /** SearchBar结束编辑 */
- (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar { // 显示导航栏
[self.navigationController setNavigationBarHidden:NO animated:YES]; // 隐藏遮罩
[[self.view viewWithTag:DJCoverTag] removeFromSuperview]; }

最终效果:

美团HD(6)-添加搜索遮罩的更多相关文章

  1. 美团HD(7)-添加取消搜索按钮

    DJSelectCityViewController.m #pragma mark - UISearchBar 代理方法 /** SearchBar开始编辑 */ - (void)searchBarT ...

  2. Android中通过ActionBar为标题栏添加搜索以及分享视窗

    在Android3.0之后,Google对UI导航设计上进行了一系列的改革,其中有一个非常好用的新功能就是引入的ActionBar,他用于取代3.0之前的标题栏,并提供更为丰富的导航效果.Action ...

  3. hexo+next博客添加搜索

    1.为什么添加algolia搜索 第一当然是可以方便的查找所需文章,第二点就是之前常用的swiftype插件不再免费.我的个人博客是这个月初搭建完成的,这时候swiftype已经不再免费,而且只开放企 ...

  4. extjs在窗体中添加搜索框

    在extjs中添加搜索框,搜索框代码如下: this.searchField = new Ext.ux.form.SearchField({            store : this.store ...

  5. lucene3.6笔记添加搜索功能

    lucene为程序添加搜索功能,此功能基于已创建好的文档的索引之上.这里我已经为一些文档建立了索引,并保存到硬盘上.下面开始针对这些索引,添加搜索功能. 1.简单的TermQuery搜索 Java代码 ...

  6. 模仿《百度音乐HD》添加到下载框动画

    上次听有人说喜欢<百度音乐HD>添加到下载动画 ,我就尝试模仿了下,没想到,今天code4app(地址)也有了这个,但是 这个动画基本相同,我们的思路还是部一样的. 都可以参考 .主要关键 ...

  7. 011.Adding Search to an ASP.NET Core MVC app --【给程序添加搜索功能】

    Adding Search to an ASP.NET Core MVC app 给程序添加搜索功能 2017-3-7 7 分钟阅读时长 作者 本文内容 1.Adding Search by genr ...

  8. dgango中admin下添加搜索功能

    admin下添加搜索功能: 在表单中加入search_fields = ['ip','hostname']   可模糊匹配 当有人在管理搜索框中进行搜索时,Django将搜索查询分解成单词,并返回包含 ...

  9. datagrid在MVC中的运用04-同时添加搜索和操作区域

    本文介绍在datagrid上同时添加搜索和操作区域. 仅仅是增加操作区域 □ 方法1 $('#dg').datagrid({ toolbar: '#tb' }); <div id="t ...

随机推荐

  1. CentOS通过yum安装MariaDB(MySQL)无法启动服务或者找不到mysql.sock

    转载自:http://www.linuxidc.com/Linux/2016-03/129396.htm 今天在Linux主机(CentOS 7)安装(yum install方式)Mariadb(即开 ...

  2. Tomcat线程池实现

    目前市场上常用的开源Java Web容器有Tomcat.Resin和Jetty.其中Resin从V3.0后需要购买才能用于商业目的,而其他两种则是纯开源的.可以分别从他们的网站上下载最新的二进制包和源 ...

  3. 【树链剖分】【线段树】bzoj2157 旅游

    #include<cstdio> #include<algorithm> using namespace std; #define INF 2147483647 #define ...

  4. [HDU6268]Master of Subgraph

    [HDU6268]Master of Subgraph 题目大意: 一棵\(n(n\le3000)\)个结点的树,每个结点的权值为\(w_i\).给定\(m(m\le10^5)\),对于任意\(i\i ...

  5. angular2学习资源汇总

    文档博客书籍类 官方网站: https://angular.io 中文站点: https://angular.cn Victor的blog(Victor是Angular路由模块的作者): https: ...

  6. hadoop InputFormat getSplits

    /** Splits files returned by {@link #listStatus(JobConf)} when * they're too big.*/ public InputSpli ...

  7. CentOS 6.9下的Setup工具(用于管理服务/防火墙/网络配置/验证服务)

    说明:Setup工具套件好像是CentOS下特有的用于管理服务/防火墙/网络配置等,其实就是基于命令行模式界面的GUI工具.唯一特点就是方便. 安装: #安装Setup命令工具 yum -y inst ...

  8. win8 下脚本安装IIS

    @echo off      echo 正在添加IIS8.0 功能,依据不同的网络速率,全程大约需要5分钟时间...      start /w pkgmgr /iu:IIS-WebServerRol ...

  9. 使用hadoop平台进行小型网站日志分析

    0.上传日志文件到linux中,通过flume将文件收集到hdfs中. 执行命令/home/cloud/flume/bin/flume-ng agent -n a4 -c conf -f /home/ ...

  10. [Unity-2] Unity播放音乐

    Unity里面大部分的功能都能够通过拖拽来实现,可是为了方便介绍,在这里都通过代码来实现.  Unity里面要播放音乐主要有下面3个要素: 1.AudioSource:控制音乐播放的主体 2.Audi ...