iOS ui--indicator HUD creation and setup

Source: Internet
Author: User

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.

    • Mode 1: Tail-up
[UIView beginAnimations:nil context:nil];[UIView setAnimationDuration:2.0];/* 需要执行动画的代码 */[UIView commitAnimations];
    • Mode 2:block Type
[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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.