An activity is a task, such as Copy, Favorite, or Find, that’s useful in the current context. Once initiated, an activity can perform a task immediately, or ask for more information before proceeding. Activities are managed by an activity view, which appears as a sheet or popover, depending on the device and orientation. Use activities to give people access to custom services or tasks your app can perform.
活动activity指在当前上下文中非常有用的任务,如复制、收藏或查找。一旦触发,活动就可以立即执行某个任务,或者在继续之前询问更多信息。活动由活动视图activity view管理,它表现为一个面板或弹窗,这取决于设备和场景定位。用户可以通过活动视图访问app的自定义服务或任务。
The system provides a number of built-in activities, including Print, Message, and AirPlay. These tasks always appear first in activity views and can’t be reordered. You don’t need to create custom activities that perform these built-in tasks. Activity views also display share and action extensions from other apps. See Sharing and Actions.
iOS系统提供了许多内置的功能,包括打印、消息和AirPlay。这些功能会出现在活动视图activity views中,并且用户无法对其进行排序。你不需要自己开发这些已内置的功能。活动视图activity views还可支持对其他app的分享和扩展操作。参见分享和行动。
Design simple template images to represent your custom activities. A template image uses a mask to create an icon. Use black and white with appropriate transparency and antialiasing, and don’t include a drop shadow. Template images should be centered in an area measuring about 70px × 70px.
Craft activity titles that succinctly describe your tasks. Titles appear below the icons in an activity view. Short titles work best. When a title is too long, iOS first shrinks the text and then—if the title is still too long—truncates it. In general, avoid including your company or product name in a title.
Make sure activities are appropriate for the current context. Although system-provided tasks can’t be reordered in an activity, they can be excluded if they aren’t applicable to your app. For example, to prevent people from printing images, you can exclude the Print activity. You can also identify which custom tasks to show at any given time.
Use the Action button to display an activity view. People are accustomed to accessing system-provided activities when they tap the Action button. Avoid confusing people by providing an alternative way to do the same thing.
应设计简单的图标来表达您自定义的活动。创建图标时使用遮罩。图标须明度清晰、抗锯齿,且不要应用阴影效果。图标应该在一个70px × 70px的区域内居中。
活动的标题内容应能简洁地描述你的任务。标题位于图标下面。简短的标题效果最好。当标题太长时,iOS会首先缩小文本字号,如果仍然太长,就将其截断。一般会避免在标题中包含公司或产品名称。
确保活动在当前上下文场景中是合适的。虽然系统提供的任务不能被重新排序,但如果不适用于你的app,它们可以被屏蔽。例如,为了防止人们打印照片,你可以屏蔽打印功能。你也可以自定义一个时间显示某个任务。
通过Action按钮来触发活动视图。人们习惯于在点击Action按钮后获取系统提供的活动。提供另一个action入口来做相同的任务会让人们感到困惑,因此要避免这种情况。