Creation and setting of indicators
Create and set a gradient animation summary for the indicator:
Describe:
使用label就能制作指示器,原理:就是让label以动画的形式慢慢显示和消失最好是半透明的指示器有时候也被称为:HUD,遮盖,蒙版
Thought steps:
1、先在storyboard的View最前面添加UILabel,或者是自定义代码添加Label (下面我用的是自定义UILable)2、然后在label的透明度(alpha,值:0~1)进行动画渐变设置 (另外:hidden是不支持动画的,值:YES/NO,从值来看是没有变化的区间,就两个值)
You can also view the alpha and hidden properties in the source code, and you'll find that the annotations explain that alpha can be used for animation, and hidden not.
[UIView beginAnimations:nil context:nil];[UIView setAnimationDuration:2.0];/* 需要执行动画的代码 */[UIView commitAnimations];
[UIView animateWithDuration:2.0 delay:1.0 options:kNilOptions animations:^{ /* 需要执行动画的代码 */ /* 注意这里的options不能用nil,要用kNilOptions */ } completion:nil]// 1s后,再执行动画(动画持续2s)
Realize:
Let's start by implementing this small example:
Finally, the second block method is used:
The final implementation code download link: Http://pan.baidu.com/s/1kT6M7sF Password: bebs
iOS ui--indicator HUD creation and setup