前一篇:iOS 8人機交互指南(12)
13. 與 iOS 融為一體(Integrating with iOS)
Integrating with iOS means giving users a compelling, delightful experience that feels at home on the platform; it doesn’t mean creating an app that looks like a copy of a built-in app.
The best way to integrate your unique app with the platform is to understand the themes that motivate iOS—these are described in Designing for iOS—and figure out how your app should express them. As you do this, follow the guidelines in this section to help you give users the experience they expect.
與 iOS 融為一體意味著提供給用戶一個引人入勝的美好體驗,使用戶在 iOS 上輕松自在;但它并不意味著要照葫蘆畫瓢地模仿內(nèi)置 app。
將你獨一無二的 app 與 iOS 平臺融合的最好方式是理解使 iOS 成為 iOS 的主旨,也就是本章 Designing for iOS 中所描述的那些內(nèi)容,其中指出了你創(chuàng)建的 app 應(yīng)當(dāng)如何表現(xiàn)。遵循這部分的指南可以幫你給予用戶他們期待的體驗。
13.1 正確使用標準 UI 元素(Use Standard UI Elements Correctly)
As much as possible, it’s a good idea to use the standard UI elements that UIKit provides. When you use standard elements instead of creating custom ones, both you and your users benefit:
(1)Standard UI elements automatically receive updates if iOS introduces a redesigned appearance—custom elements don’t get updated.
(2)Standard UI elements tend to offer various ways to customize their appearance or behavior. For example, all views (that is, objects that inherit from?UIView) can be tinted using the?tintColor?property, which makes it easy to add color to your app.
(3)People are comfortable with the standard UI elements, so they instantly understand how to use them in your app.
最好盡可能使用 UIKit 提供的 UI 標準元素。當(dāng)你使用標準元素而不是創(chuàng)建自定義元素時,你和你的用戶都會受益:
(1)標準 UI 元素會隨著 iOS 的重設(shè)計而自動升級,自定義元素則不行。
(2)標準 UI 元素傾向于提供多種方式來自定義它們的外觀和行為。例如,所有視圖(繼承自 UIView 的對象)可以使用 tintColor 屬性來染色,這使得向應(yīng)用中添加顏色變得容易。
(3)人們習(xí)慣于標準 UI 元素,他們能夠立即理解如何在 app 中使用這些元素。
To take advantage of the benefits of using standard UI elements, it’s crucial that you:
Follow the guidelines for every UI element.?When a UI element looks and works the way people expect it to, they can depend on their prior experience to help them use it in your app. You can find UI element guidelines in?Bars,?Content Views,?Controls, and?Temporary Views.
Don’t mix UI element styles from different versions of iOS.?You don’t want to confuse users by displaying UI elements that look like they belong in a different version of iOS than the version that’s currently running on the device.
In general, avoid creating a custom UI element that performs a standard action.?First, ask yourself why you’re creating a custom UI element that behaves exactly like a standard one. If you just want a custom look, consider changing the look of a standard element by using the UIKit appearance customization APIs or tint color. If you want a slightly different behavior, be sure to find out whether a standard element might do what you want when you adjust its properties and attributes. If you need completely custom behavior, it’s best to design a custom element that doesn’t look too similar to the standard ones.
充分發(fā)揮使用標準 UI 元素的好處,有幾點需要注意:
遵循指南中提及的方法來使用每一個 UI 元素。當(dāng) UI 元素操作行為所見即所得時,用戶可以依靠他們的先驗知識來更好地使用你的 app。UI 元素指南可以參見?Bars、Content Views、Controls?和?Temporary Views。
不要混淆不同 iOS 版本下的 UI 元素樣式。你一定不希望因為 UI 元素看上去不像他們正在使用的 iOS 版本卻像另一個不同的版本而使用戶感到困惑。
一般情況,不要創(chuàng)建一個與標準行為相同的自定義 UI 元素。首先,捫心自問為什么要創(chuàng)建一個自定義 UI 元素卻有著標準元素的行為。如果你只是想看上去不同,那可以考慮使用 UIKit 外觀自定義 API 或染色來改變標準元素的樣式。如果你想要一個稍有不同的行為,那一定要確保調(diào)整標準元素的屬性也不能滿足需求。如果需要完全自定義的行為,那最好設(shè)計一個徹底的自定義元素,不要和標準元素太相似。
TIP
Interface Builder makes it easy to get the standard UI elements, use the appearance customization APIs, access properties and attributes, and apply custom and system provided icons to your controls. To learn more about Interface Builder, see?Xcode Overview.
提示
接口構(gòu)建器(Interface Builder)使獲得標準 UI 元素變得容易,使用外觀自定義 API,訪問屬性,對控件應(yīng)用自定義和系統(tǒng)提供的圖標。了解接口構(gòu)建器的更多信息,可以查看?Xcode Overview。
Don’t use system-defined buttons and icons to mean something else.?iOS provides many buttons and icons that you can use in your app. Be sure you understand the documented, semantic meaning of these buttons and icons; don’t rely on your interpretation of their appearance. (You can find the meaning of each icon in?Toolbar and Navigation Bar Buttons?and?Tab Bar Icons.)
If you can’t find a system-provided button or icon that has the appropriate meaning for a function in your app, you can create your own. For some guidelines to help you design custom icons, see?Bar Button Icons.
不要使用系統(tǒng)定義的按鈕或圖標來表達其他含義。iOS 提供許多按鈕和圖標供你在 app 中使用。務(wù)必準確理解這些按鈕和圖標的含義,不要僅憑外觀推斷。(在?Toolbar and Navigation Bar Buttons?和?Tab Bar Icons?中可以了解每個圖標的含義)
如果發(fā)現(xiàn)系統(tǒng)提供的按鈕或圖標無法恰當(dāng)?shù)乇磉_ app 中的功能,那就可以自定義。更多信息詳見?Bar Button Icons。
If your app enables an immersive task or experience, it may be reasonable to create completely custom controls.?This is because you’re creating a unique environment, and discovering how to control that environment is an experience users expect in such apps.
如果你的 app 需要完成一個擬真的任務(wù)或經(jīng)歷,那可能創(chuàng)建一個完全自定義的控件更加合理。這是因為你正在創(chuàng)建一個獨一無二的環(huán)境,而發(fā)現(xiàn)如何控制環(huán)境本身也是一種用戶體驗。
13.2 淡化對文件和文檔的處理(Downplay File and Document Handling)
iOS apps can help people create and manipulate files, but this doesn’t mean that people should have to think about the file system on an iOS device.
iOS app 能夠幫助人們創(chuàng)建和操作文件,但是這不意味著用戶需要考慮 iOS 設(shè)備的文件系統(tǒng)。
If your app helps people create and edit documents, it works well to provide some sort of app-specific document library view that lets them open an existing document or create a new one. Ideally, such a library view:
(1)Is highly graphical.?People should be able to easily identify the document they want by looking at visual representations of the documents onscreen.
(2)Lets people make the fewest possible gestures to do what they want.?For example, people might scroll horizontally through a carousel or grid of existing documents and open the desired one with a tap.
(3)Includes a new document function.?Instead of making people go somewhere else to create a new document, a document library might let them tap a placeholder image to create a new document.
如果你的 app 幫助用戶創(chuàng)建并編輯文檔,那提供某種類型的文檔庫視圖會比較好,這樣讓用戶可以打開一個已有文件或者創(chuàng)建一個新文件。理想情況下,是這樣一個庫視圖:
(1)高度圖形化。用戶應(yīng)該能夠通過屏幕上文檔的可視化展示輕易找出他們希望操作的文檔。
(2)讓用戶采用最少的步驟就能完成想做的操作。例如用戶可以水平滾動已有文檔的輪播或網(wǎng)格視圖,然后點擊打開某個文件。
(3)包含新建文檔功能。不要讓用戶去其他地方尋找該如何新建文檔,文檔庫可以讓用戶點擊占位符圖片就輕松創(chuàng)建一個新文檔。
For example, Pages displays the user’s documents, along with an easy way to create new documents, in a graphical library view.
例如,Pages 顯示用戶文檔,同時在圖形化的庫視圖中提供一個簡單的方式創(chuàng)建新文檔。

TIP
You can use the Quick Look Preview feature to let people preview documents within your app, even if your app can’t open them. To learn how to provide this feature in your app, see?Quick Look.
提示
你可以使用快速查看預(yù)覽(Quick Look Preview)功能來讓用戶在 app 中預(yù)覽文檔,即使你的 app 無法打開它們。了解更多該功能相關(guān)信息,參見?Quick Look。
If your app lets people use documents that they created in other apps, you can display a modal document picker view controller to help them access these documents. The document picker view controller can display documents in the user’s iCloud Drive in addition to Document Provider extensions, which are associated with other document-creation or document-storage apps. To learn more about Document Provider extensions, see?Document Provider Extensions; to learn more about the document picker view controller, see?Document Picker Programming Guide.
如果你的 app 讓用戶使用他們在其他 app 中創(chuàng)建的文檔,你可以顯示一個模態(tài)文檔拾取視圖控制器(document picker view controller)來訪問這些文檔。文檔拾取視圖控制器能顯示用戶 iCloud Drive 中的文檔以及文檔提供(Document Provider)擴展。文檔提供擴展與其他應(yīng)用創(chuàng)建的文檔或文檔存儲 app 相關(guān)。了解更多關(guān)于文檔提供擴展,可以查看 Document Provider Extensions;了解更多關(guān)于文檔拾取視圖控制器,可以查看 Document Picker Programming Guide。
Give people confidence that their work is always preserved unless they explicitly cancel or delete it.?If your app helps people create and edit documents, don’t require them to take an explicit save action. iOS apps should take responsibility for saving people’s input, both periodically and when they open a different document or switch away from the app.
要讓用戶相信他們的操作總是得以妥善保留,除非顯式地取消或刪除。如果你的 app 幫助用戶創(chuàng)建并編輯文檔,那不要讓用戶采用顯式的保存動作。iOS 應(yīng)用應(yīng)當(dāng)隨時保存用戶輸入,不管是定期保存還是在用戶打開其他文檔或切換至其他應(yīng)用時的立即保存。
If the main function of your app isn’t content creation—but you allow people to switch between viewing information and editing it—it can make sense to ask them to save their changes. In this scenario, it often works well to provide an Edit button in the view that displays the information. When people tap the Edit button, replace it with a Save button and add a Cancel button. The transformation of the Edit button helps remind people that they’re in an editing mode and might need to save changes, and the Cancel button gives them the opportunity to exit without saving their changes.
如果 app 主要功能不是創(chuàng)建內(nèi)容——但你允許用戶在查看信息和編輯信息間切換——此時詢問用戶是否保存修改就是有意義的了。在這種情況下,最好在顯示信息的視圖中提供一個編輯按鈕。當(dāng)用戶點擊編輯按鈕,將編輯按鈕變?yōu)楸4姘粹o,并增加一個取消按鈕。這種編輯按鈕的轉(zhuǎn)變幫助提醒用戶他們處于編輯態(tài),并需要保存修改,而取消按鈕則讓用戶可以不保存退出。
13.3 必要時支持可配置(Be Configurable If Necessary)
Some apps might need to give users a way to make setup or configuration choices, but most apps can avoid or delay doing this. Successful apps work well for most people right away, while also offering some convenient ways to adjust the user experience.
When you design your app to function the way most of your users expect, you decrease the need for settings. If you need information about the user, query the system for it instead of asking users to provide it. If you decide you must provide app settings that users rarely need to change, see?The Settings Bundle?to learn how to support them in your code.
有些 app 可能需要為用戶提供一種渠道來設(shè)置或配置某些選項,但大部分 app 應(yīng)該避免或推遲這樣做。成功的 app 應(yīng)該能夠立即為大部分人所用,與此同時也提供一些方便的方式來調(diào)整用戶體驗。
當(dāng)你按照大部分用戶期待的方式設(shè)計 app 時,你就降低了對設(shè)置的需求。如果你需要用戶信息,可以從系統(tǒng)中查詢而不是讓用戶提供。如果你決定一定要提供用戶很少需要改變的 app 設(shè)置,參見?The Settings Bundle?來學(xué)習(xí)如何在代碼中支持。
As much as possible, offer configuration options in the main UI.?Putting options in the main UI can make sense if the options represent a primary task and if people might want to change them frequently. If people are likely to change an app’s configuration only occasionally, it can make sense to put them in a separate view.
If necessary, help users go directly to your app’s settings in Settings.?In particular, if you display a message that describes where to find your settings, such as “Go to Settings > MyApp > Privacy > Location Services,” replace the description with a button that opens that location in Settings. To learn how to enable this behavior, see?Settings Launch URL.
盡可能在主要的 UI 中提供配置項。如果選項代表一個基礎(chǔ)任務(wù)或者用戶可能會經(jīng)常修改,那么將選項放在主要的 UI 中很有意義。如果用戶很可能只是偶爾修改 app 配置,那把它們放在單獨的視圖中比較好。
如有可能,幫助用戶直達設(shè)置中的對應(yīng)應(yīng)用設(shè)置。尤其是,如果你顯示了一個消息來描述如何找到設(shè)置,例如“前往設(shè)置》我的應(yīng)用》隱私》定位服務(wù)”,那還不如為這段描述增加一個按鈕,點擊按鈕即可打開設(shè)置中的對應(yīng)位置。了解更多內(nèi)容參見?Settings Launch URL。
13.4 充分利用 iOS 技術(shù)(Take Advantage of iOS Technologies)
iOS provides a wealth of technologies that support common tasks and scenarios in ways that users expect. This expectation means that it’s almost always better to integrate system-supported technologies into your app than it is to design a custom approach.
Some iOS technologies—such as?Multitasking?and?VoiceOver—are system features that all apps should incorporate. Others enable specific app functionality, such as handling tickets and gift cards (Passbook), enabling user purchases within an app (In-App Purchase), displaying in-app advertising (iAd Rich Media Ads), integrating with?Game Center, and supporting?iCloud.
iOS 按照用戶期望的樣子提供豐富的技術(shù)來支持常見任務(wù)和場景。這意味著將系統(tǒng)支持的技術(shù)融合到你自己的 app 中幾乎總是優(yōu)于采用自定義的方法。
某些 iOS 技術(shù)——例如多任務(wù)和語音——是所有 app 應(yīng)該配合的系統(tǒng)特性。其他還有一些技術(shù),使 app 具有特殊功能,例如處理票據(jù)和禮物卡(Passbook),使用戶在 app 中購買(In-App Purchase),顯示應(yīng)用內(nèi)廣告(iAd Rich Media Ads),集成到游戲中心(Game Center),以及支持 iCloud。
后一篇:iOS 8人機交互指南(14)