iphone:Supporting-copy-and-paste
出自UXGuide.net
请帮助我们修订和更新本文的译文部分
本文的译文部分可能是由多个贡献者提供或从不同的渠道收集,未经过最终审阅和整理,请您帮助我们一起修订和更新本文的译文部分。
支持复制和粘贴
Supporting Copy and Paste
iPhone OS provides an edit (or pasteboard) menu that supports Cut, Copy, Paste, Select, and Select All operations in text views, web views, and image views. One of the ways users can reveal the menu is to first touch and hold to display the magnified view (which allows them to move the insertion or selection point to the correct location) and then release. If the menu is supported in the current context, it appears when the finger is lifted. Choosing Select in the menu selects the word or application-defined item in the view. Users can extend their selection by dragging the handles on the currently selected area. After a selection is made, the menu can display Cut, Copy, or Paste, as appropriate.
iPhone操作系统提供了一个编辑(或粘贴板)菜单,用来支持剪切,复制,粘贴,选择,选择全部这些操作,它应用于文本,网页和图片的视图中。让此菜单显示的一种方式是:用户长按屏幕,呈现放大视图(它允许用户移动光标或者是选区点至正确的位置)后释放手指即可。如果菜单在当前环境下可用,那么当手指释放后,他就会显示。在菜单选择"选择"这个菜单项,即可在视图中选择单词或有定义的应用程序项。用户可通过拖动选择区域边缘的手柄扩展选区,当选区确定后,就会自然而然的显示一个提供剪切,复制或粘贴命令的菜单。
You can adjust some of the behaviors of the edit menu to suit your application. (For information on how to implement these behaviors in code, see “Copy and Paste Operations” in iPhone Application Programming Guide.) For example, you can specify the subset of commands the menu displays and you can influence where the menu appears. You have no control over the color or shape of the menu itself.
你可以调整编辑菜单的某些行为以适应你的应用程序。(关于如何用代码实施这些行为的信息,请参见在 iPhone应用程序编程指南中的“复制和粘贴操作”。)例如,你可以指定菜单显示命令子集,或决定菜单应在哪里呈现。但是你不能支配菜单的颜色或本身的形状。
The commands visible in the edit menu make sense in the current context. For example, if nothing is selected, the menu does not contain Copy or Cut because these commands act on a selection. Similarly, if something is selected, the menu does not contain Select. If you support an edit menu in a custom view, you’re responsible for making sure that the commands the menu displays are appropriate for the current context. Note that you cannot specify custom commands to display in the menu.
在编辑菜单显示的命令在当前的环境下应是合理的。举例来说,如果未选中任何内容,菜单上就不应包含“复制”或“剪切”,因为它们是针对选区执行的命令。同样,如果已选中某些内容,菜单上就不应包含“选择”这个命令。如果你的自定义视图支持编辑菜单,你有责任确保该菜单的命令在当前视图的显示是恰当的。请注意,你不能指定在菜单中显示自定义的命令。
UIKit displays the edit menu above or below the insertion point or selection, depending on available space, and places the menu pointer so that users can see how the menu commands relate to the content. You can programmatically determine the position of the menu before it appears, so you can prevent important parts of your application’s user interface from being obscured, if necessary.
UIKit在光标或者选区的上方或下方显示编辑菜单,它取决于屏幕的可用空间和菜单指针的位置,因为这样便于用户看到菜单的命令与上下文的关系。你可以使用程序化的方式在菜单出现之前确定它的位置,可防止应用程序用户界面的重要组成部分被其遮挡。(如果可能被遮挡的话)
Note that although the touch and hold gesture is the primary way users reveal the edit menu, they can also double-tap a word in a text view to select it and reveal the menu at the same time. If you support the menu in a custom view, you should respond to both gestures. In addition, you can define the object that is selected by default when the user double taps.
请注意,虽然长按手势是用户使编辑菜单显示主要的方式,他们还可以在文本浏览中双击某个单词来选择它,并同时使编辑菜单显示。如果你的应用程序允许在自定义视图中提供编辑菜单,就应该同时支持这两种手势。此外,你可以定义当用户双击时默认选中的对象。
Avoid creating a button that performs a command that’s available in the edit menu. For example, it’s better to allow users to perform a copy operation using the edit menu than to provide a Copy button, because users will wonder why there are two ways to do the same thing in your application.
避免建立一个按钮,提供编辑菜单中的命令。例如,相比提供一个复制按钮,让用户使用编辑菜单执行复制操作的方式更好,因为用户会对你的应用程序存在两种方式做相同的事情而感到困惑。
You can enable selection of static text, but only when the static text represents content that’s useful to the user. For example, a user might want to copy the caption of an image, but they’re not likely to want to copy the label of a tab item or a screen title, such as Accounts. In a text view, selection by word should be the default.
你可以启用对静态文本的选区功能,但应只在静态文本表示的含义对用户有实际作用的时候才启用。例如,用户可能想要复制图像的标题,但他们不太想复制标签项或屏幕标题的文本标签,例如帐户。在文本视图中,应该是默认按单词来选择的(而不是字母)。
Button titles should not be selectable because it would be difficult for users to reveal the edit menu without activating the button. In general, elements that behave as buttons don’t need to be selectable.
按钮标题是不能够被选择的,因为对用户来说不触发按钮而显示菜单是困难的。一般来说,具有按钮行为的元素是无需被选择的。
If you support the Cut, Copy, and Paste commands in your application, you should also support undo and redo (described in “Supporting Undo and Redo”). This is because the edit menu does not require confirmation before the actions are performed and users often expect to be able to undo recent operations if they change their minds.
如果你的应用程序中支持剪切,复制,粘贴命令,你也应该支持撤消和重做(参照“支持撤消和重做”)。这是因为编辑菜单不要求在操作之前执行进行确认,并且当用户改变主意时,他们往往希望能够撤消最近的操作。