Custom circle progress view [closed]

有些话、适合烂在心里 提交于 2019-12-13 11:28:12

问题


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


回答1:


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


来源:https://stackoverflow.com/questions/28495396/custom-circle-progress-view

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!