zoukankan      html  css  js  c++  java
  • iOS 画圆

        _demoView = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
        [self.view addSubview:_demoView];
        
        CAShapeLayer *shapeLayer = [CAShapeLayer layer];
        shapeLayer.frame = _demoView.bounds;
        UIBezierPath *path = [UIBezierPath bezierPathWithOvalInRect:_demoView.bounds];
        shapeLayer.path = path.CGPath;
    //    shapeLayer.strokeEnd = 1.0f;
    //    shapeLayer.strokeStart = 0.75f;
        shapeLayer.fillColor = [UIColor clearColor].CGColor;
        shapeLayer.lineWidth = 2.0f;
        shapeLayer.strokeColor = [UIColor redColor].CGColor;
        [_demoView.layer addSublayer:shapeLayer];
        CABasicAnimation *pathAnima = [CABasicAnimation animationWithKeyPath:@"strokeEnd"];
        pathAnima.duration = 3.0f;
        pathAnima.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
        pathAnima.fromValue = [NSNumber numberWithFloat:0.0f];
        pathAnima.toValue = [NSNumber numberWithFloat:1.0f];
        pathAnima.fillMode = kCAFillModeForwards;
        pathAnima.removedOnCompletion = NO;
        [shapeLayer addAnimation:pathAnima forKey:@"strokeEndAnimation"];
    
  • 相关阅读:
    对于dll(动态链接库)的理解
    Java中异常发生时代码执行流程
    使用Gitea搭建git服务
    python-grpc
    Docker环境变量设置
    pandas操作excel
    docker笔记
    flask笔记
    索引原理
    视图、触发器、事务、存储过程
  • 原文地址:https://www.cnblogs.com/Milo-CTO/p/7889769.html
Copyright © 2011-2022 走看看