新建搜索bar
CGFloat enterW = self.view.frame.size.width - 80;// 245;
CGFloat y = 0;
containerView = [[UIView alloc] initWithFrame:CGRectMake(0, y, self.view.frame.size.width, 40)];
[self.view addSubview:containerView];
textField = [[UITextField alloc] initWithFrame:CGRectMake(10, 5, enterW-10, 30)];
textField.font = [UIFont systemFontOfSize:18.0f];
textField.returnKeyType = UIReturnKeyDone;
textField.clearButtonMode = UITextFieldViewModeWhileEditing; //显示一次性删除按钮
textField.backgroundColor = [UIColor whiteColor];
textField.layer.borderWidth = 1.0;
textField.layer.cornerRadius = 5.0;
textField.layer.borderColor = [UIColor lightGrayColor].CGColor; //显示边框颜色
textField.leftViewMode = UITextFieldViewModeAlways;
textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; //控件居中
textField.leftView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"searchIcon"]];
textField.leftView.contentMode=UIViewContentModeCenter; //显示左边放大镜
textField.autoresizingMask = UIViewAutoresizingFlexibleWidth;
[containerView addSubview:textField];
UIButton *uploadBtn = [[UIButton alloc] init];
uploadBtn.frame = CGRectMake(self.view.frame.size.width - 70 - 5, 5, 70, 30);
[uploadBtn setTitle:@"搜索" forState:UIControlStateNormal];
[uploadBtn successStyle];
[uploadBtn addTarget:self action:@selector(uploadBtnPressed) forControlEvents:UIControlEventTouchUpInside];
[containerView addSubview:uploadBtn];
[containerView addObserver:self forKeyPath:@"frame" options:NSKeyValueObservingOptionNew context:nil];
NSLog(@"containerView y %f", containerView.frame.origin.y);
新建搜索bar的更多相关文章
- iOS搜索框
在iOS8以前搜索框是作为一个控件添加到TableViewController中, 有系统自带的搜索变量self.searchDisplayController 遵守一个搜索显示的协议<UISe ...
- SharePoint 2013 配置启用搜索服务
原文:SharePoint 2013 配置启用搜索服务 1.安装完毕SharePoint 2013,新建网站集,点击搜索,出现如下错误(因为没配置,别激动). 2.尝试启动服务器场中的服务之Share ...
- SharePoint 2013配置启用搜索服务
1.安装完毕SharePoint 2013,新建网站集,点击搜索,出现如下错误(因为没配置,别激动). 2.尝试启动服务器场中的服务之SharePoint Server Search,提示新建搜索应用 ...
- Sharepoint 2013搜索服务配置总结(实战)
分享人:广州华软 星尘 一. 前言 SharePoint 2013集成了Fast搜索,相对于以前版本搜索的配置有了一些改变,在安装部署Sharepoint 2013时可以选择默认创建搜索服务,但有时候 ...
- Windows下的搜索神器 —— everything
介绍一款Windows下的神奇 -- everything,软件很小巧,但是搜索速度非常快,比Windows自带的搜索功能更强大.更快.掌握它的基本用法,在查找文件时能提升很高的效率 1.下载 2.基 ...
- Solr搜索器的特性及相关操作
一.搜索处理器简介 所有的请求处理器都实现一个Java类,本例实现了solr.SearchHandler.在运行时,solr.SearchHandler被解析为内置的Solr类org.apache.s ...
- SharePoint 2013 Search 配置总结
前言:SharePoint 2013集成了Fast搜索以后,搜索的配置有了些许改变,自己在配置过程中,也记录下了一些入门的东西,希望能够对大家有所帮助. 1.配置搜索服务,首先需要启用搜索功能,基本思 ...
- [转]你不需要jQuery
完全没有否定jQuery的意思,jQuery是一个神奇的.非常有用的工具,可以节省我们大量的时间. 但是,有些时候,我们只需要jQuery的一个小功能,来完成一个小任务,完全没有必要加载整个jQuer ...
- UIView---汇总
视图.绘图.贴图.手势.变形.布局.动画.动力.特效 UIBezierPath.UIGestureRecognizer.CGAffineTransform.frame.bounds.center.tr ...
随机推荐
- SharePoint 2010 最佳实践学习总结------第2章 SharePoint Windows PowerShell指南
第2章 SharePoint Windows PowerShell指南 SharePoint 2010是SharePoint系列产品中第一个开始支持Windows PowerShell的产品,在以前的 ...
- PHPnow升级PHP 5.4与Mysql 5.5
本文转载自:https://www.dadclab.com/archives/5928.jiecao 折腾开始 1.安装一下VC9的运行库,下载地址:https://www.microsoft.com ...
- 【转】分析Redis架构设计
一.前言 因为近期项目中开始使用Redis,为了更好的理解Redis并应用在适合的业务场景,需要对Redis设计与实现深入的理解. 我分析流程是按照从main进入,逐步深入分析Redis的启动流程.同 ...
- 装过photoshop后出现configuration error
1.你用的应该是精简版的PS,找到ps启动图标,点击右键,以管理员身份运行试试. 2.可以右键你的快捷方式,选择兼容性,后面有个选框“以管理员身份运行”,应用,下次就不报错了.
- postgresql数据库文件目录
不同的发行版位置不同 查看进程 ps auxw | grep postgres | grep -- -D 找到默认的目录 /usr/lib/postgresql/9.4/bin/postgres -D ...
- ifconfig报错:SIOCSIFFLAGS: Operation not permitted
# insmod mt7601Usta.ko rtusb init rt2870 --->usbcore: registered new interface driver rt2870 # iw ...
- UVa 297 Quadtrees(树的递归)
Quadtrees 四分树就是一颗一个结点只有4个儿子或者没有儿子的树 [题目链接]UVa 297 Quadtrees [题目类型]树的递归 &题意: 一个图片,像素是32*32,给你两个先序 ...
- 转-ViewPager组件(仿微信引导界面)
http://www.cnblogs.com/lichenwei/p/3970053.html 这2天事情比较多,都没时间更新博客,趁周末,继续继续~ 今天来讲个比较新潮的组件——ViewPager ...
- Spring中IoC的入门实例
Spring中IoC的入门实例 Spring的模块化是很强的,各个功能模块都是独立的,我们可以选择的使用.这一章先从Spring的IoC开始.所谓IoC就是一个用XML来定义生成对象的模式,我们看看如 ...
- JAVA 处理程序异常,(try、catch、finally),(thorws)
一.try语句: try{//这里写可能出现异常的程序} catch(Exception e){//这里写如果出现异常怎么处理的程序} 二.throws语句 语法:函数方法() throws Exc ...