iphone:Providing-search-and-displaying-search-results

出自UXGuide.net

跳转到: 导航, 搜索

请帮助我们修订和更新本文的译文部分

本文的译文部分可能是由多个贡献者提供或从不同的渠道收集,未经过最终审阅和整理,请您帮助我们一起修订和更新本文的译文部分。

提供搜索功能并显示搜索结果
Providing Search and Displaying Search Results

UIKit provides the search bar control you can use to display a consistent interface to initiate searching, but you are responsible for implementing search in your application. (To learn more about the search bar, see “Search Bars”; to learn more about handling search results in code, see UISearchDisplayController Class Reference.) To ensure that search is a useful and convenient experience users appreciate, take some time to consider how to implement the process and how to display the results.

在你开始搜索时,UIKit提供了一致性界面的搜索栏控件,但在你的应用程序中,实现搜索功能则是属于你自己的责任。(要了解更多关于搜索栏的信息,请参阅“搜索栏”,要了解更多关于如何在代码中对待搜索结果的信息,请参阅 UISearchDisplayController Class 参考。)为了确保让搜索对于用户来说是一个有用且方便的体验,你应花点时间考虑如何落实搜索进程和如何显示搜索结果。

In general, you should:
一般来说,你应该:

为你的数据建立索引,以便随时查找。
对本地数据进行即时及时筛选,一旦用户开始输入,你就可以显示结果,随着用户继续输入而逐步缩小范围。
如果可能,同时筛选用户的远端数据,如果响应时间被推迟多于一两秒钟,就需要用户的许可(是否筛选远端数据)。
在列表上面显示搜索栏或在列表里显示索引。
避免使用标签作为搜索,除非它是应用程序中的主要功能必须用一个有区别的方式显示。

Although live-filtering data usually produces a superior user experience, it’s not always practical. When this is the case, you can begin the search process after the user taps the Search button in the keyboard. If you do this, be sure to provide feedback on the search’s progress so users know that the process has not stalled. One way to do this is to display textual results as soon as possible and display placeholder content for data that might take longer to retrieve.

虽然及时的数据筛选通常会带来出色的用户体验,但这并不总是具有实用性。如果是这种情况下(非即时筛选数据),当用户敲击了键盘上的搜索按钮后,你才能开始执行搜索进程了。如果你这样做,一定要提供搜索进程情况的反馈,以便用户知道该进程并没有停滞不前。一种方法是,尽快的先显示文本搜索结果,而对于需要花点时间才能从数据中检索完毕的内容,先显示一个占位符(后再慢慢显示具体检索内容)。

In YouTube, for example, users initiate a search for videos by tapping the Search button. If the network connection is slow, YouTube first displays the Loading... message along with a spinning activity indicator so users know that search is proceeding. Then, YouTube displays a results list in which each row is populated with textual results, such as video title and viewer rating, and a custom image of a box with a dotted outline. As users scan the list of video titles, the video thumbnails replace the dotted boxes as they are downloaded. Displaying partial search results while additional data is still downloading gives users useful information promptly.

在YouTube,例如,用户点击搜索按钮开始视频搜索。如果网络连接速度慢,YouTube上首先显示 正在载入... 的信息和一个旋转指示符,以便用户知道搜索在进行中。然后,YouTube以列表的形式的显示出结果,以文本的形式填充每一行,例如视频标题和评分,以及一个点线描边自定义图像框。当用户在浏览视频标题列表时,视频的缩略图也在同时下载,当下载完完成后,他们会机会替换掉点线框。当更多数据在被下载的时候,先显示局部搜索结果,能够尽快地给用户提供有用的信息。

If you handle data that sorts naturally into different categories, you can provide a scope bar. A scope bar contains up to four scope buttons, each representing a category. For example, Mail provides a scope bar that allows users to focus their search on the From, To, or Subject fields of messages, or broaden the search to include all fields. Consider providing a scope bar if it helps users focus their search or if it significantly reduces the number of results. (To learn how to implement a scope bar in your code, see UISearchBar Class Reference.)

如果你要处理本来就属于不同种类的数据,你可以提供一个范围栏。一个范围栏包含四个范围选择按钮,分别代表一个类别。例如,邮件提供了一个范围控件栏,让使用者可将其搜索集中在,发件人,收件人或邮件的主题,或把搜索扩大到全部。如果它能够帮助用户让搜索更集中,或者是能显著地减少搜索结果数,那么就应该提供范围栏。 (要了解如何在你的代码里实现一个范围栏,参见 UISearchBar Class 参考。)

个人工具
名字空间
变换
动作
导航
工具箱