1. searchBar = [[UISearchBar alloc] initWithFrame: CGRectMake(0.0, 0.0, self.view.bounds.size.width, 40)];
  2. searchBar.placeholder=@"Enter Name";
  3. searchBar.delegate = self;
  4. searchBar.showsCancelButton = YES;
  5. theTableView.tableHeaderView = searchBar;
  6. searchBar.keyboardType = UIKeyboardTypeDefault;
  7. //searchBar.autocorrectionType = UITextAutocorrectionTypeNo;
  8. //searchBar.autocapitalizationType = UITextAutocapitalizationTypeNone;
  9. [self.view addSubview: searchBar];
  10. //search Button clicked....
  11. - (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar                     // called when keyboard search button pressed
  12. {
  13. NSLog( @"%s,%d" , __FUNCTION__ , __LINE__ );
  14. [searchBar resignFirstResponder];
  15. }
  16. //cancel button clicked...
  17. - (void)searchBarCancelButtonClicked:(UISearchBar *) searchBar                    // called when cancel button pressed
  18. {
  19. NSLog( @"%s,%d" , __FUNCTION__ , __LINE__ );
  20. [searchBar resignFirstResponder];
  21. }

UISearchBar的使用的更多相关文章

  1. iOS 如何自定义UISearchBar 中textField的高度

    iOS 如何自定义UISearchBar 中textField的高度 只需设置下边的方法就可以 [_searchBar setSearchFieldBackgroundImage:[UIImage i ...

  2. iOS之搜索框UISearchController的使用(iOS8.0以后替代UISearchBar+display)

    在iOS 8.0以上版本中, 我们可以使用UISearchController来非常方便地在UITableView中添加搜索框. 而在之前版本中, 我们还是必须使用UISearchBar + UISe ...

  3. 更改UIsearchbar 的背景和cancel按钮(转)

    修改背景 searchbar =[[UISearchBar alloc]initWithFrame:CGRectMake(,KTopBarHeight, , KTopBarHeight)]; sear ...

  4. UISearchBar控件-让我们来搞定!(转)

    转载自:http://blog.sina.com.cn/s/blog_7b9d64af0101dfg8.html     最近用到搜索功能.于是,经过不断的研究,终于,有点懂了. 那就来总结一下吧,好 ...

  5. iOS开发——UI进阶篇(十九)UISearchBar控件简介

    最近用到搜索功能.总结一下 搜索,无疑可以使用UISearchBar控件! 那就先了解一下UISearchBar控件吧! UISearchBar控件就是要为你完成搜索功能的一个专用控件.它集成了很多你 ...

  6. IOS开发UISearchBar失去第一响应者身份后,取消按钮不执行点击事件的问题

    在iOS开发中,使用UISearchBar的时候,当搜索框失去焦点的时候,取消按钮是默认不能点击的,如图按钮的颜色是灰色的:  这是因为此时取消按钮的enabled属性被设置为NO了,那么当我们需要让 ...

  7. 修改UISearchBar的背景颜色

    当你看到这篇博客你就已经发现了用_searchBar.backgroundColor = [UIColor clearColor];来设置UISearchBar的颜色完全没有效果: 并且,有些方法是想 ...

  8. iOS UISearchBar 设置取消按钮,回收键盘,并修改cancel为“取消”

    继承协议: UISearchBarDelegate 在代理方法中设置: #pragma mark --- 搜索框开始编辑 --- - (void)searchBarTextDidBeginEditin ...

  9. iOS开发之直接使用UISearchBar

    iOS开发中经常需要使用SearchBar,我们可以选择使用UISearchBar+UISearchController或者UISearchBar+UISearchDisplayController( ...

  10. 自定义UISearchBar

    先上系统默认的UISearchBar,然后用KVO修改 UISearchBar *searchBar = [[UISearchBar alloc]initWithFrame:_topView.boun ...

随机推荐

  1. Unity2016 Unity3D开发VR游戏的经验

    http://z.youxiputao.com/articles/8313 在4月12日的Unite 2016大会上,暴风魔镜高级产品经理吴涛分享他用Unity3D开发VR游戏的经验,以下为分享实录: ...

  2. express框架之1

    express框架: 1.依赖中间件 2.接受请求 get / post / use get('/地址' , function(req , resp ){}) post和use 同理 3.非破坏式 4 ...

  3. 后端开发福音!GitHub上15W+的后台控制面板!

    Web 开发中几乎的平台都需要一个后台管理,但是从零开发一套后台控制面板并不容易,幸运的是有很多开源免费的后台控制面板可以给开发者使用,那么有哪些优秀的开源免费的控制面板呢?我在 Github 上收集 ...

  4. 51Nod 1127 最短的包含字符串 (尺取法)

    #include <iostream> #include <algorithm> #include <string> #include <cstring> ...

  5. Tomcat - 怎么控制某个类或者包下的日志打印级别

    问题与分析 Tomcat是使用自己的日志实现tomcat-juli.jar来打印日志信息的,日志会被打印到catalina.out里,除去你在项目里自己使用的日志框架外,由System.out,Sys ...

  6. ios wkwebview 跳转到新的controllerview加载页面 出现闪退问题

    func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) { if(isF ...

  7. ko.js循环绑定值问题(工作遇见)

    fewTags()这是一个数组,循环实现以上效果,箭头所指的不属于循环出来的值, 以前循环是绑定在<div class="file-tag-list">中造成编辑不能在 ...

  8. POJ1470 LCA (Targan离线)

    bryce1010模板 http://poj.org/problem?id=1470 /*伪代码 Tarjan(u)//marge和find为并查集合并函数和查找函数 { for each(u,v) ...

  9. Azkaban是什么?(一)

    不多说,直接上干货! http://www.cnblogs.com/zlslch/category/938837.html Azkaban是什么?  Azkaban是一套简单的任务调度服务,整体包括三 ...

  10. ubuntu用户注销后登录xmodmap无法自动运行

    2015-12-17 21:34:50 还是无法解屏后 自动运行xmodmap ,继续谷歌找到一方法,选装gnome-tweak-tool sudo apt-get install gnome-twe ...