UISearchBar示例代码 [英] UISearchBar Sample Code

查看:84
本文介绍了UISearchBar示例代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实施搜索栏可能是一项棘手的业务,我正在努力使其适用于我的情况。以下是我发现的用于实现UISearchBar的一些示例代码的集合。请分享以下您在下面发现的任何其他内容。

Implementing a searchbar can be tricky business and I'm struggling to make it work for my situation. Here's a collection of some of the sample code I've found for implementing a UISearchBar. Please share any others below you've come across below.

Apple的 TableSearch 代码实现了对简单表视图的类似联系人的搜索。

Apple's TableSearch code implements a contacts-like search of a simple tableview.

开始iPhone Dev Book的章节示例代码在分段的tableview上实现了searchBar。数据来自plist。

Beginning iPhone Dev Book's Sections sample code implements a searchBar on a sectioned tableview. Data is pulled from a plist.

iPhone开发者手册第8章,10a SearchBar 示例搜索颜色名称表。选择颜色名称会更改搜索栏的色调。
另见他们的第9章01a-Finding People应用程序。

iPhone Developers Cookbook Chapter 8, 10a SearchBar example searches a table of color names. Selection of a color name changes the tint of the search bar. Also see their Chapter 9 01a-Finding People app.

iPhoneSDK的源代码 TableViewPart6 搜索国家/地区名称表,其中有2个部分可供访问的国家和访问的国家/地区。

iPhoneSDK's source code TableViewPart6 searches a table of country names with 2 sections for countries visited and those to visit.

斯坦福的iPhone app编程类的 08-MyTableView 示例过滤了一个简单的列表姓名。

Stanford's iPhone app programming class's 08-MyTableView sample filters a simple list of names.

推荐答案

等待:
Apple在iPhone SDK 3.0中实现了搜索显示控制器。您可以将其拖到tableView的标题,或以编程方式将其设置为headerView。您只需要设置一些简单的参数(比如dataSource,它只是一个UITableViewDatasource和一个viewController,其结果必须显示在其中)。这使您看起来与联系人应用程序和所有其他Apple应用程序完全相同(您也可以像邮件应用程序一样设置'范围')

WAIT: Apple has implemented the Search Display Controller in the iPhone SDK 3.0. You can drag that to the header of your tableView, or programmatically set that as headerView. You only have to set a few simple parameters (like the dataSource, which is just an UITableViewDatasource and a viewController, where the results have to been showed in). This gives you exactly the same look as the contacts-application and all other Apple-applications (you can also set 'scopes' like the Mail-app)

这篇关于UISearchBar示例代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆