使用UISearchDisplayController】的更多相关文章

iOS中UISearchDisplayController用于搜索,搜索栏的重要性我们就不说了,狼厂就是靠搜索起家的,现在越来越像一匹没有节操的狼,UC浏览器搜索栏现在默认自家的神马搜索,现在不管是社交,O2O还是在线教育等都会有一个搜索栏的实现,不过彼此实现效果是不一样的.iOS中的搜索栏实现起来相对简单一点,网上也有很多参考资料,不过靠谱的不是很多,很多都是iOS 8.0之前的实现,iOS 8.0上的实现貌似很少看到,可以运行,不过会看到searchDisplayController' is…
UISearchBar继承自UIView.UIResponder.NSObject 属性: autocapitalizationType————自动对输入文本对象进行大小写设置(包含4种类型,但是有时候键盘会屏蔽此属性) autocorrectionType————自动对输入文本对象进行纠错. backgroundImage————searchbar的背景图片,如果图片不是可伸缩的或者1点宽,则一般被平铺 barStyle————控件的样式 delegate————控件的委托,委托要遵从UISe…
感觉好多文章不是很全面,所以本文收集整合了网上的几篇文章,感觉有互相补充的效果. 如果想下载源码来看:http://code4app.com/search/searchbar .本源码与本文无关 1.searchBar 本例子实现布局:上面是一个navigationController,接下来一个searchBar,下面是tableView searchBar这个控件就用来搜索tableView上的数据 [[UISearchDisplayController alloc] initWithSea…
1. UISerachBar 继承与UIView, 包含uitextfield, 并且实现了uitextfielddelegate代理的主要内容 含有取消按钮, 默认不显示 2. UISerachDisplayController 包含 uisearchbar, uitableview, uinavigaitionitem 以及 uiviewcontroller 每一个uiviewcontroller有一个类型为UISerachDisplayController的属性, 但默认为nil demo…
那我们开始吧,下面是Sely写的一个Demo,分享给大家. 新建一个项目, UISearchDisplayController 的 displaysSearchBarInNavigationBar太死板了,达不到想要的效果. 这里进行重新定制, 四个协议, 三个成员变量,第一步OK. @interface ViewController ()<UISearchBarDelegate,UISearchDisplayDelegate, UITableViewDataSource, UITableVie…
最近在做一个简单的app入门,中间有一个页面用到了搜索框,本来以为很简单的控件,没想到用到的时候才发现很麻烦. 搜索框使用过程大约有以下几个状态:不活跃-活跃-输入关键词-根据关键词动态列出相关结果-选中搜索结果或取消搜索 // ViewController.h#import <UIKit/UIKit.h> @interface ViewController : UIViewController<UITableViewDataSource, UITableViewDelegate, UI…
UISearchDisplayController是iOS中用于处理搜索功能的控制器,此控制器需要和UISearchBar结合使用 示例代码如下: // // WKRootViewController.m // 表格视图的搜索功能 // // Created by student on 14-10-20. // Copyright (c) 2014年 wukong. All rights reserved. // #import "WKRootViewController.h" @in…
(注:自iOS8起,苹果便废弃UISearchDisplayController的使用,改为使用UISearchController来实现类似功能,可参考我的另一篇文章“Swift - 使用UISearchController实现带搜索栏的表格”) UISearchDisplayController控件默认封装了Search Bar和Table View,可同时提供搜索和结果表格显示功能. 下面提供了一个使用样例,同时通过代码定制Search Bar的一些属性来实现自定义的外观和效果,并且展示用…
一般,我们用到UISearchDisplayController的时候,都是须要对一个数据源进行刷选,在UISearchDisplayController自带的tableView中展示出来,然后点击退出详情.我近期在做大众点评第三方的时候,遇到一个问题,我展示出了所有商店,想加搜索功能,可是不知道输入的搜索keyword去跟什么匹配,大众点评也并没有提供一个用来刷选的数据源接口,这样,我仅仅能自己输入keyword,不用它数据源提供刷选补全内容,而直接点击弹出键盘的搜索键,进行搜索.只是点击搜索…
UISearchDisplayController和UISearchBar一起使用用来管理UISearchBar和搜索结果的展示.UISearchDisplayController提供了显示搜索结果的tableview来覆盖原控制器的视图: 使用UISearchDisplayController须要: 提供搜索结果table的数据的来源-searchResultsDataSource 搜索结果table的代理 SearchResultsDelegate UISearchDisplayContro…
分组表+本地搜索 UISearchDisplayController  UISearchBar 的使用 效果图 @interface CityListViewController :UIViewController<UITableViewDataSource,UITableViewDelegate,UISearchBarDelegate> @property (nonatomic, retain) UITableView*mTableView; @property (nonatomic, re…
随着iOS 的升级,iOS 7的占有率更低了.Xcode 升级到Xcode 8之后,对iOS 应用支持的最低版本,iOS 7也被抛弃了.我在新项目中也是最低支持到iOS 8,因此工程里也是各种警告.首先看到的就是UISearchDisplayController建议替换为UISearchController. 以前的搜索功能回顾 以前我们要在表格头部加一个搜索功能是这样写的: //解决搜索栏在取消时,抖动问题. [self setAutomaticallyAdjustsScrollViewIns…
大熊猫猪·侯佩原创或翻译作品.欢迎转载,转载请注明出处. 如果觉得写的不好请多提意见,如果觉得不错请多多支持点赞.谢谢! hopy ;) 以前iOS的搜索一般都使用UISearchDisplayController来完成,不过自从iOS 8.0开始,该控制器被标记为废弃,我们可以在iOS 8.0之后使用一个新的搜索控制器UISearchController来完成搜索. 本篇博文将介绍以上2种搜索控制器的简单用法,并比较它们的区别.Let't Go! UISearchDisplayControll…
使用UISearchDisplayController 虽然UISearchDisplayController名字中带有controller,可他不是一个UIView相关的controller,因为,切换显示UISearchDisplayController的时候,它并没有在UIWindow中加载(UIWindow一次只能加载一个controller,所以可以证明它不属于controller). 可以看看,他是继承自NSObject,是多个控件组合在一起的一个东西. 以下是使用时的效果图: 源码…
原文 http://hi.baidu.com/happywilma0118/item/e6d5730a499bba1b3a53eef8 UISearchBar继承自UIView.UIResponder.NSObject 属性: autocapitalizationType————自动对输入文本对象进行大小写设置(包含4种类型,但是有时候键盘会屏蔽此属性) autocorrectionType————自动对输入文本对象进行纠错. backgroundImage————searchbar的背景图片,…
iOS7中UISearchDisplayController 与UISearchBar结合使用时,有时候会出现搜索框获得焦点时,阴影遮盖部分挡住了搜索框,影响用户使用,如下图 API中没有阴影图层的接口,尝试分析解决 1.使用Reveal,查找遮盖图层,发现为_UISearchDisplayControllerDimmingView 2.找到该图层,修改对应的frame,通过上图可以发现dimmingview与searchResultsTableView为同一视图的子图层. - (void)se…
// // FirstViewController.swift // SearchDisplayDemo // // Created by Bruce Lee on 24/12/14. // Copyright (c) 2014 Dynamic Cell. All rights reserved. // import UIKit class FirstViewController: UIViewController, UITableViewDelegate, UITableViewDataSou…
UISearchDisplayController 是苹果专为 UITableView 搜索封装的一个类. 里面内置了一个 UITableView 用于显示搜索的结果.它可以和一个需要搜索功能的 controller 关联起来,其它的像原 TableView 和搜索结果 TableView 的切换, mask 的显示等等都 封装好了,使用起来非常非常的简单.特别是要实现全屏搜索时使用最多. 全屏搜索的意思是如果你用了  NavigationBar 当点击搜索框时 TableView 会自动弹上去…
本文转载至 http://blog.sina.com.cn/s/blog_74e9d98d01019vji.html   在之前做过的应用中,很多都有“搜索”这个功能,大部分情况下我都是只采用UISearchBar并结合UItableView来展示搜索结果,其 实IOS SDK中已经有自带的控件能帮助我们做好这些事,这就是UISearchDisplayController,当然这个控件也有一些不足之处,下面我就一 一道来.. 首先我先讲下UISearchDisplayController的实现原…
本文转载至 http://www.cnblogs.com/pengyingh/articles/2350154.html - (void)searchDisplayControllerWillBeginSearch:(UISearchDisplayController *)controller { UISearchBar *searchBar = self.searchDisplayController.searchBar; [searchBar setShowsCancelButton:YES…
本文转载至 http://blog.sina.com.cn/s/blog_bf2d33bd01017q6l.html @interface ThirdViewController : UIViewController@property(nonatomic,retain)UITableView *tv;@property(nonatomic,retain)NSMutableArray *tarray,*filteredArray;@property(nonatomic,retain)UISearc…
How do I cover the "no results" text in UISearchDisplayController's searchResultTableView? I don't want to show the "no results" text while my server is processing a search query. I figured out the exact coordinates of the table cell t…
Recently I needed to fully customize a UISearchBar, so here are some basic "recipes" on how to manage that using a UISearchDisplayController. 1. Changing the title of the "cancel" button If you want to localize your UISearchBar or just…
最近项目遇到一个很奇葩的问题 点击按钮启动 presentViewController 的时候出现下图效果: 代码: AddFriendViewController *addFriendVC = [[AddFriendViewController alloc] init]; UINavigationController *nav =[[UINavigationController alloc] initWithRootViewController:addFriendVC]; [self pres…
1.searchResultsUpdater:设置显示搜索结果的控制器 ? 1     _mySearchController.searchResultsUpdater = self; 2.dimsBackgroundDuringPresentation:设置开始搜索时背景显示与否 ? 1     _mySearchController.dimsBackgroundDuringPresentation = NO; 3.[searchBar sizeToFit]:设置searchBar位置自适应…
#pragma mark - UISearchBarDelegate//当搜索文本被改变的时候调用 - (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText { //改变searchController中tableView的位置 _searchController.searchResultsTableView.frame = CGRectMake(kZero, _tableViewY, kScr…
不能调用self.navigationController.navigationBar.hidden = YES: 调用此代码的话,你隐藏了navigationBar搜索展示控制器就拿不到导航条:就会再搞一个navigationBar,搜索展示控制器是要替换导航条的.(当点击searchBar时,它会自动上移并且遮住navigationController,经过测试,如果上面是navigationBar,则searchBar不会移动,但如果是UINavigationController自带过来的…
出现如下错误: 2016-02-13 22:09:22.318 Test[2757:192106] *** Assertion failure in -[UISearchResultsTableView dequeueReusableCellWithIdentifier:forIndexPath:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3512.30.14/UITableView.m:6564 出现这种…
在iOS开发中UITableView可以说是使用最广泛的控件,我们平时使用的软件中到处都可以看到它的影子,基本大部分应用都有UITableView.当然它的广泛使用自然离不开它强大的功能,今天就针对UITableView重点展开讨论. 1.UITableView有两种风格:UITableViewStylePlain和UITableViewStyleGrouped. 一.如何选择grouped Or Plain 1.grouped的sectionHeader,sectionFooter的背景色默认…
--UIKit之UITableView 概述 在iOS开发中UITableView可以说是使用最广泛的控件,我们平时使用的软件中到处都可以看到它的影子,类似于微信.QQ.新浪微博等软件基本上随处都是UITableView.当然它的广泛使用自然离不开它强大的功能,今天这篇文章将针对UITableView重点展开讨论.今天的主要内容包括: 基本介绍 数据源 代理 性能优化 UITableViewCell 常用操作 UITableViewController MVC模式 基本介绍 UITableVie…