• 画圆圈


    画圆圈

    by 伍雪颖



    CGPoint CGRectGetCenter(CGRect rect){
       
    returnCGPointMake(CGRectGetMidX(rect),CGRectGetMidY(rect));
    }
    @interfaceViewController () {
       
    CAShapeLayer *circleLayer;
    }
    @property (nonatomic,strong)CADisplayLink *timer;
    @end
    @implementation ViewController

    - (
    void)viewDidLoad {
        [
    superviewDidLoad];
       
    circleLayer = [CAShapeLayerlayer];
       
    CGFloat radius =30.0;
       
    UIBezierPath *path = [UIBezierPathbezierPathWithArcCenter:CGRectGetCenter(self.view.frame)
                                                           
    radius:radius
                                                       
    startAngle:-0.5 * M_PI
                                                         
    endAngle:1.5 * M_PI
                                                        
    clockwise:YES];
       
    circleLayer.path = path.CGPath;
       
    circleLayer.strokeColor = [UIColorredColor].CGColor;
       
    circleLayer.lineWidth =3;
       
    circleLayer.fillColor =nil;
       
    circleLayer.contentsScale = [UIScreenmainScreen].scale;
        [
    self.view.layeraddSublayer:circleLayer];
    }

  • 相关阅读:
    1040 Longest Symmetric String (25)
    1068 Find More Coins (30)
    1045 Favorite Color Stripe (30)
    1008 数组元素循环右移问题 (20)
    1007. 素数对猜想
    1005. 继续(3n+1)猜想 (25)
    1001. 害死人不偿命的(3n+1)猜想 (15)
    递归经典面试题_ 小例
    简单实现_控制台小时钟
    使用Timer组件_实现定时更改窗体颜色
  • 原文地址:https://www.cnblogs.com/mengfanrong/p/5088801.html
Copyright © 2020-2023  润新知