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"];
    
  • 相关阅读:
    Python流程控制
    Python 迭代器和列表解析
    Python 文件对象
    TF-IDF介绍
    hexo博客更换主题
    学习笔记—MapReduce
    Mac下Anaconda的安装和使用
    Flume的介绍和简单操作
    hexo+github搭建个人博客
    Hbase的安装和基本使用
  • 原文地址:https://www.cnblogs.com/Milo-CTO/p/7889769.html
Copyright © 2011-2022 走看看