[Activity Indicators]简介

Activity Indicators

An activity indicator is a spinning wheel that indicates a task is in the midst of being processed. If an action takes a noticeable and indeterminate amount of time to process—such as a CPU-intensive task or connecting to a network—you should display an activity indicator to give assurance to the user that your app is not stalled or frozen.

活跃指示器 是一个旋转的轮子表示一个任务正在处理中。如果一个动作花费了值得注意的、不确定的大量的时间去处理,比如一个CPU消耗大的任务或者网络连接。这种情况下你应该显示一个活跃指示器来让用户确信你的app没有停止运转或者卡住。

Purpose. Activity indicators allow users to:

  • Receive feedback that the system is processing information

Implementation. Activity indicators are implemented in the UIActivityIndicatorView class and discussed in the UIActivityIndicatorView Class Reference.

Configuration. Configure activity indicators in Interface Builder, in the Activity Indicator section of the Attributes Inspector. A few configurations cannot be made through the Attributes Inspector, so you must make them programmatically. You can set other configurations programmatically, too, if you prefer.

在Interface Builder的Activity Indicator 的Attributes Inspector里面配置activity indicator。有一些配置时不可以通过属性检查器来设置,所以一定要通过编程来实现。当然,如果你更喜欢的话,其他属性也可以通过编程的方法来实现。

Content of Activity Indicators

An activity indicator is indeterminate, and has no starting or ending values associated with it.

活跃指示器是不确定的,没有与之相关的起始值活着结束值。

Behavior of Activity Indicators

The Animating (isAnimating) box is unchecked by default; checking it causes the activity indicator to start animating. This is the equivalent of calling the startAnimating method.

动画框是默认勾选的;勾选这个会使活跃指示器开始动画。这与调用startAnimating方法是等价的。

Select the Hides When Stopped (hidesWhenStopped) field in the Attributes Inspector for your activity indicator to disappear when the animation ends. When you call the startAnimating and stopAnimating methods, the activity indicator automatically shows and hides onscreen. This way, you won’t have to worry about displaying a stationary activity indicator.

在属性检查器中勾选hides when stopped框来使activity indicator在动画结束时消失。当你调用startAnimating和stop Animating方法,activity indicator 会自动地在屏幕上显示和隐藏。这样子,你将不必担心展示了固定的activity indicator。

Appearance of Activity Indicators

You can customize the appearance of an activity indicator by setting the properties depicted below.

你可以通过如下描绘的属性来自定义activity indicator的外观。

To customize the appearance of all activity indicators in your app, use the appearance proxy (for example, [UIActivityIndicatorView appearance]). For more information about appearance proxies, see Appearance Proxies.

使用外观代理(appearance proxy)来自定义你app里面的所有activity indicator的外挂。更多详情请看Appearance Proxies.

Style

The Style (activityIndicatorViewStyle) field represents the predefined style of the activity indicator. Use the style to specify one of two default colors: white or gray. You can also select a larger size for your indicator using the “Large White” style option.

Style域呈现了预定义的活跃指示器风格。使用style来选定两个默认颜色之一:白色或者灰色。你也使用“Large White(巨大的白色的)”风格选项为指示器选择一个更大的大小。

The Color (color) field allows you to specify a custom color for your indicator. This property takes precedence over any color set using the Style field. However, if your style is set to Large White, your activity indicator appears a larger size. Make sure your indicator is set to a different style option if you want to use the small indicator.

Color域允许你为你的指示器规定一个自定义颜色。这个属性优先于任何通过Style域设定的颜色。但是,如果style被设置为Large White,你的指示器显示为一个更大大小。如果你想使用一个小的指示器的话,确认你的指示器被设置为一个不同风格选项。(意思是说Large White 是白色,但不要为了用白色来选择那个选项,因为它会使指示器变大)

Using Auto Layout with Activity Indicators

You can create Auto Layout constraints between an activity indicator and other UI elements.

你可以在activity indicator 和其他UI 元素之间创建自动布局约束。

Typically, activity indicators appear before a label or centered within a view. To align with a label, constrain Bottom Edges and Horizontal Space to the label with the standard value. To center within a view, add the Horizontal Center in Container and Vertical Center in Container constraints.

一般地,activity indicators在标签或者在一个视图中剧中前显示。与一个标签排列,用标准值约束底部边距和相对便签的水平空间。在Container 约束中增加一个Horizontal Center(水平居中) 和Vertical Center(垂直居中)来在一个视图中居中。

For general information about using Auto Layout with iOS views, see Using Auto Layout with Views.

Making Activity Indicators Accessible

Activity indicators are accessible by default. The default accessibility trait for an activity indicator is User Interaction Enabled.

Activity indicators默认是可以访问的.默认的访问特性可以通过User Interaction 来设定。

If you have a label next to your activity indicator that describes the processing task in more detail, you might want to disable its accessibility with the isAccessibilityElement property so VoiceOver reads the label instead. Otherwise, VoiceOver reads “In progress” while the activity indicator is animating, and “Progress halted” while it is not.

如果你在activity indicator边上有标签来描述正在进行中的任务更多的细节,你大概想要用isAccessibilityElement属性来禁用,使得VoiceOver取而代之朗读标签的内容。否则,VoiceOver会在activity indicator还在旋转的时候读出"正在处理",停止旋转的时候读出"停止处理"。

VoiceOver will read only elements that are visible onscreen. If you enable the hidesWhenStopped property, VoiceOver might abruptly stop speaking when the animation finishes.

VoiceOver将只会读屏幕上可视的元素。如果激活了hidesWhenStopped(结束时隐藏)属性,VoiceOver很大可能在动画结束的时候突然停止发声。

For general information about making iOS views accessible, see Making Views Accessible.

Internationalizing Activity Indicators

Activity indicators have no special properties related to internationalization. However, if you use an activity indicator with a label, make sure you provide localized strings for the label.

Activity indicators没有与国际化相关的属性。但是,如果你和标签一起用的话,确认你为标签提供了本地化的描述。

For more information, see Internationalization and Localization Guide.

Debugging Activity Indicators

When debugging issues with activity indicators, watch for this common pitfall:

Specifying conflicting appearance settings. The color property takes precedence over any color set using the activityIndicatorViewStyle property. However, if your style is set to Large White, your activity indicator appears a larger size with whatever custom color you set. Make sure your indicator is set to a different style option if you want to use the small indicator.

使用了冲突的外观设置。color属性比任何使用activityIndicatorViewStyle属性的设置有更高的优先级。但是,如果你的style被设置为Large White,你的activity Indicator无论你设置了什么自定义颜色都会显示了一个更大的大小。如果你想使用一个更小的指示器,确认你的指示器被设置为一个不同的选项。

Elements Similar to an Activity Indicator

The following element provides similar functionality to an activity indicator:

以下的元素提供了与activity indicator相似的功能:

Progress View. A class that represents a progress bar. Use this class instead of an activity indicator when your task takes a determinate amount of time. For more information, see Progress Views.

一个显示进程条的类。使用这个类取代activity indicator。

时间: 2024-08-05 19:34:19

[Activity Indicators]简介的相关文章

Activity详解

Activity是android应用的重要组成单元之一(另外3个是Service,BroadcastReceiver和ContentProvider).实际应用包含了多个Activity,不同的Activity向用户呈现不同的操作界面.Android应用的多个Activity组成Activity栈,当前活动的Activity位于栈顶.对于Android应用而言,Activity主要负责与用户交互,并向用户呈现应用状态. 1 建立.配置和使用Activity 1.1 Activity类简介 当一个

Android Notification通知详解

Android Notification通知详解 Notification: (一).简介: 显示在手机状态栏的通知.Notification所代表的是一种具有全局效果的通知,程序一般通过NotificationManager服务来发送Notification. Android3.0增加了Notification.Builder类,该类可以轻松地创建Notification对象. (二).Notification.Builder类中提供的方法: builder.setAutoCancel();

Android Notification通知详细解释

Android Notification通知具体解释 Notification: (一).简单介绍: 显示在手机状态栏的通知. Notification所代表的是一种具有全局效果的通知,程序一般通过NotificationManager服务来发送Notification. Android3.0添加了Notification.Builder类.该类能够轻松地创建Notification对象. (二).Notification.Builder类中提供的方法: builder.setAutoCance

论 Swift 开发入门:活动指示器(UIActivityIndicatorView)

转载请声明出处:http://blog.csdn.net/jinnchang/article/details/44828021 ------------------------------------------------------------------------------------------ 代码示例 // // ViewController.swift // UIActivityIndicatorViewSample // // Created by jinnchang on

Android设计和开发系列第一篇:Notifications通知(Develop)

Develop篇 Building a Notification PREVIOUSNEXT THIS LESSON TEACHES YOU TO Create a Notification Builder Define the Notification's Action Set the Notification's Click Behavior Issue the Notification YOU SHOULD ALSO READ Notifications API Guide Intents

Android设计和开发系列第一篇:Notifications通知(Develop—API Guides)

Notifications IN THIS DOCUMENT Design Considerations Creating a Notification Required notification contents Optional notification contents and settings Notification actions Notification priority Creating a simple notification Applying an expanded lay

Android学习笔记(四)

2.      Settings.System.getInt(ContentResolvercr, String name, int def)方法从系统设置(settings)参数的集合中取出名称为name的参数的参数值,如果系统设置中没有该参数,则返回默认值def. 3.      Activity的函数setVolumeControlStream(intstreamType)用于设置所在Activity中音量控制键控制的音频流,一般在onCreate()函数中设定.其中,streamType

第2章2节《MonkeyRunner源码剖析》了解你的测试对象: NotePad窗口Activity之NotesList简介(原创)

天地会珠海分舵注:本来这一系列是准备出一本书的,详情请见早前博文"寻求合作伙伴编写<深入理解 MonkeyRunner>书籍".但因为诸多原因,没有如愿.所以这里把草稿分享出来,所以错误在所难免.有需要的就参考下吧,转发的话还请保留每篇文章结尾的出处等信息. NotePad窗口Activity之NotesList简介 上一节我们简要描述了测试对象NotePad的主要功能模块,那么这一节开始我们就会对每个模块进行相应的阐述,这样读者就算没有真正去安装和玩过这个应用也不会影响大

第2章4节《MonkeyRunner源码剖析》了解你的测试对象: NotePad窗口Activity之菜单简介(原创)

天地会珠海分舵注:本来这一系列是准备出一本书的,详情请见早前博文"寻求合作伙伴编写<深入理解 MonkeyRunner>书籍".但因为诸多原因,没有如愿.所以这里把草稿分享出来,所以错误在所难免.有需要的就参考下吧,转发的话还请保留每篇文章结尾的出处等信息. NotePad窗口Activity之菜单简介 这里我们总共用到两种类型的菜单,一种叫做Context Menu,就是上下文菜单:一种叫做Option Menu,就是我们按下系统菜单按键后会弹出来的系统菜单选项. Not