iphone:Text-fields

出自UXGuide.net

跳转到:导航, 搜索

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

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

文本框
Text Fields

A text field is a rounded rectangular field that accepts user input. When the user taps a text field a keyboard appears; when the user taps Return in the keyboard, the text field handles the input in an application-specific way. A text field can contain a single line of input. Figure 9-14 shows two text fields in the Maps application.

文本框是个圆角矩形域,用来接收用户的输入。当用户轻敲文本框的时候,键盘就会出现;当用户轻敲键盘上的返回键时,文本框用应用程序指定的方式来处理输入。文本框可以包含一行输入。图9-14显示了地图应用程序的两个文本框。

Figure 9-14  A text field can accept user input
图9-14 文本框可以接受用户输入

ui_textfields.jpg

You can customize a text field to help users understand how they should use it in your application. For example, you can display custom images in the left or right sides of the text field, or a system-provided button, such as the Bookmarks button shown in Figure 9-14. In general, you should use the left end of a text field to indicate its purpose and the right end to indicate the presence of additional features, such as bookmarks.

你可以自定义文本框,以帮助用户了解他们应该如何在应用程序中使用它。例如,你可以在文本框的左边或右边显示自定义图像,或一个系统提供的按钮,如在图9-14所示的书签按钮。一般而言,你应该使用文本框的左端显示其用途,右端显示存在的附加功能,比如书签。

You can also cause the Clear button to appear in the right end of a text field. When this element is present, tapping it clears the contents of the text field, regardless of any other image you might display over it.

你也可以让清除按钮出现在文本框的右端。当此清除按钮出现,点击它以清除文本框里的的内容,不用考虑其他任何你可能会显示在这里的图像。

Sometimes, it helps users understand the purpose of a text field if it displays a hint, such as “Name.” A text field supports the display of such placeholder text, which can appear when there is no other text in the field. To learn more about using a text field and customizing it to display images and buttons, see UITextField Class Reference.

有时候,为了帮助用户了解一个文本框的目的,而显示提示,如“名称”。在文本框里没有文字时,文本框里会显示一个文本占位符。要了解更多关于使用文本框和个性化定制文本框来显示图像和按钮的信息,请参阅 UITextField 类型参考

You can specify different keyboard styles to accommodate different types of content you expect users to enter. (Note that you have no control over the keyboard’s input method and layout, which are determined by the user’s language settings.) For example, you might want to make it easy for users to enter a URL, a PIN, or a phone number. iPhone OS provides several different keyboard types, each designed to facilitate a different type of input. To learn about the keyboard types that are available, see UIKeyboardType. To learn more about managing the keyboard in your application, read “Managing the Keyboard” in iPhone Application Programming Guide.

你可以定义不同的键盘样式来适应你期望用户输入的不同内容。(注意你不能控制键盘的输入方式和布局,这是由用户的语言设置决定的。)举个例子,你可能想更方便用户输入URL,密码或者电话号码。iPhone OS提供多种不同的键盘样式,每种都设计成利于一种不同的输入。要了解可供使用的键盘类型,详见 UIKeyboardType。要了解更多如何在你的应用程序里管理键盘的信息,详见 iPhone 应用程序编程向导中的“管理键盘”

导航
工具箱