自定义圈子进度视图

时间:2015-02-13 08:33:31

标签: ios objective-c iphone ios7

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

http://i.stack.imgur.com/KO9ec.png

1 个答案:

答案 0 :(得分:0)

拍摄上面图像中显示的白色圆圈图像,然后尝试下面的代码。

- (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];
                         }
                     }
                 }];
}