iOS 使用UIBezierPath, CAShapeLayer, CABasicAnimation动态绘制折线
来源:互联网 发布:龙泉刀剑章氏有淘宝吗 编辑:程序博客网 时间:2024/05/17 01:51
直接在UIViewController的ViewDidLoad()方法中.
UIBezierPath *path = [UIBezierPath bezierPath]; [path moveToPoint:CGPointMake(30, 200)]; // 第一个点 [path addLineToPoint:CGPointMake(100, 250)]; // 第二个点 [path addLineToPoint:CGPointMake(250, 170)]; // 第三个点 CAShapeLayer *pathLayer = [CAShapeLayer layer]; pathLayer.frame = self.view.frame; pathLayer.path = path.CGPath; pathLayer.strokeColor = [UIColor redColor].CGColor; // 线段颜色 pathLayer.fillColor = [UIColor clearColor].CGColor; // pathLayer.lineWidth = 17; pathLayer.lineCap = kCALineCapRound; pathLayer.lineJoin = kCALineJoinRound; [self.view.layer addSublayer:pathLayer]; CABasicAnimation *pathAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"]; pathAnimation.duration = 5; pathAnimation.fromValue = [NSNumber numberWithFloat:0.0f]; pathAnimation.toValue = [NSNumber numberWithFloat:1.0f]; [pathLayer addAnimation:pathAnimation forKey:@"strokeEnd"];
0 0
- iOS 使用UIBezierPath, CAShapeLayer, CABasicAnimation动态绘制折线
- iOS 使用UIBezierPath与CABasicAnimation绘制图形
- iOS动画详解 (CABasicAnimation,UIBezierPath,CAShapeLayer)
- IOS_ UIBezierPath + CABasicAnimation + CAShapeLayer
- 使用CAShapeLayer和UIBezierPath绘制色盘
- 使用CAShapeLayer与UIBezierPath画动态柱状图
- IOS CAShapeLayer CAGradientLayer UIBezierPath 使用实例
- iOS开发示例————使用CAShapeLayer&UIBezierPath绘制数据饼图
- [iOS Swift3.0] 定位二维码+绘制定位框+简单使用UIBezierPath和CAShapeLayer
- iOS 通过UIBezierPath和CAShapeLayer绘制圆形进度条
- ios CAShapeLayer和UIBezierPath
- UIBezierPath+CAShapeLayer 绘制自定义图形
- CAShapeLayer与UIBezierPath绘制图形
- Swift CAShapeLayer,UIBezierPath绘制图形
- 使用 UIBezierPath+CAShapeLayer 实现不在View层绘制自定义图形
- 使用CAShapeLayer与UIBezierPath
- iOS图形绘制 UIBezierPath 绘制折线图、柱状图、饼形图
- iOS 使用UIBezierPath 绘制图形
- 7-包装器函数+Match对象+Date对象+note
- Java缩略图生成库之Thumbnailator应用说明
- lintcode 第12题
- 设计模式之禅读书笔记1
- js局部刷新
- iOS 使用UIBezierPath, CAShapeLayer, CABasicAnimation动态绘制折线
- Java中的file.separator
- 笔记
- 一个简单实用的cURL模拟http请求的函数
- Leetcode 435. Non-overlapping Intervals
- Caused by: java.sql.SQLException: sql injection violation, syntax error: ERROR. token : DESC
- js中的instanceof运算符
- awk,sed
- 单点登陆的三种实现方式