自定义圈子进度视图 [英] Custom circle progress view

查看:82
本文介绍了自定义圈子进度视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经常搜索,但无法在互联网上找到这样的控件。
你能帮我自己做吗?

I search a lot, but cant find control like this in internet. Can you help me to do this my own?

推荐答案

取白色圆圈图像你在上面的图像中显示并尝试下面的代码。

Take white circle image like you displayed in above image and try following code.

- (void)startSpin
{
    if (!animating)
    {
        animating = YES;
        [self spinWithOptions: UIViewAnimationOptionCurveEaseIn];
    }
}

- (void)spinWithOptions:(UIViewAnimationOptions) options
{
    [UIView animateWithDuration: 1.0f
                      delay: 0.0f
                    options: options
                 animations: ^{
                     imgViewCircle.transform = CGAffineTransformRotate(imgViewCircle.transform, M_PI / 2);
                 }
                 completion: ^(BOOL finished) {
                     if (finished) {
                         if (animating) {
                             // if flag still set, keep spinning with constant speed
                             [self spinWithOptions: UIViewAnimationOptionCurveLinear];
                         } else if (options != UIViewAnimationOptionCurveEaseOut) {
                             // one last spin, with deceleration
                             [self spinWithOptions: UIViewAnimationOptionCurveEaseOut];
                         }
                     }
                 }];
}

这篇关于自定义圈子进度视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆