UISearchBar 示例代码 [英] UISearchBar Sample Code

查看:25
本文介绍了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 代码实现了一个联系人——比如搜索一个简单的tableview.

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

Beginning iPhone Dev Book 的Sections 示例代码在分段的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 Developers Cookbook Chapter 8, 10a SearchBar 示例搜索颜色名称.选择颜色名称会更改搜索栏的色调.另请参阅他们的 Chapter 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.

Stanford 的 iPhone 应用程序编程课程的 08-MyTableView 示例过滤一个简单的名字列表.

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

推荐答案

WAIT: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天全站免登陆