OC(四)-动画部分 - 图1

    1. //核心动画
    2. CGRect rect = CGRectMake(50, 100, 100, 100);
    3. CAShapeLayer * shapeLayer = [CAShapeLayer layer];
    4. shapeLayer.frame = rect;
    5. shapeLayer.strokeColor = [[UIColor redColor] CGColor];
    6. //圆形
    7. //UIBezierPath * Bpath = [UIBezierPath bezierPathWithOvalInRect:rect];
    8. //长方形
    9. //UIBezierPath * Bpath = [UIBezierPath bezierPathWithRect:rect];
    10. //圆角矩形
    11. UIBezierPath * Bpath = [UIBezierPath bezierPathWithRoundedRect:rect cornerRadius:60];
    12. //单独一个或几个角
    13. //UIBezierPath * Bpath = [UIBezierPath bezierPathWithRoundedRect:rect byRoundingCorners:(UIRectCornerTopLeft) cornerRadii:(CGSize){ 50,50 }];
    14. shapeLayer.path = Bpath.CGPath;
    15. [self.view.layer addSublayer:shapeLayer];