自定义圈子进度视图

Custom circle progress view

我找了很多,但在网上找不到这样的控件。 你能帮我自己做吗?

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

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