设置圆形进度条:

实现效果如下:

实现代码如下:(注释很详细啦!!!)

  UIView *circleView = [[UIView alloc]initWithFrame:CGRectMake(, , , )];
shapeView.backgroundColor = [UIColor greenColor];
[self.view addSubview:circleView]; // 实现圆形进度条 CAShapeLayer *shapeLayer =[CAShapeLayer layer];
shapeLayer.frame = circleView.bounds;
//绘制
UIBezierPath *path = [UIBezierPath bezierPathWithOvalInRect:circleView.bounds];
shapeLayer.path = path.CGPath;
// 设置填充颜色
shapeLayer.fillColor = [UIColor greenColor].CGColor;
// 设置线条宽度
shapeLayer.lineWidth = 2.0f;
// 设置线条颜色
shapeLayer.strokeColor = [UIColor redColor].CGColor;
[circleView.layer addSublayer:shapeLayer]; // 设置基础动画
CABasicAnimation *pathAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"];
pathAnimation.duration = 3.0;
pathAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
pathAnimation.fromValue = [NSNumber numberWithFloat:0.0f];
pathAnimation.toValue = [NSNumber numberWithFloat:1.0f];
pathAnimation.fillMode = kCAFillModeForwards;
pathAnimation.removedOnCompletion = NO;
[shapeLayer addAnimation:pathAnimation forKey:@"strokeEndAnimation"];

最后记录一个警告的意思和处理方法:

如果出现上面的这警告问题,原因是:

这个往往是复制网上的带格式的代码导致的。

解决办法:

在提示的地方进行换行处理,首先先选中提示的"_".然后按回车键即可。

最好的方法还是自己敲代码比较合适,不复制就不会出现这些警告啦!!!!

最新文章

  1. 异步Socket 客户端部分
  2. redis数据结构存储Linked List设计细节(redis的设计与实现笔记)
  3. SQL Server 连接超时案例一则
  4. oracle自定义判断数据是否为数值函数
  5. Unity逻辑热更新
  6. Echarts 页面多图自适应的解决办法 (转)
  7. php +html5 websocket 聊天室
  8. USB HID usage table
  9. 【转】SQL Server 2012 配置AlwaysOn(三)
  10. Nexus 5完全拆解
  11. VB6.0数据库开发五个实例——罗列的总结
  12. Wireshark网络抓包(一)——数据包、着色规则和提示
  13. 【HotSpot】 jps
  14. 使用handler倒计时
  15. BZOJ3524[Poi2014]Couriers——主席树
  16. tigervnc-server安装使用
  17. springMVC和json整合配置方法
  18. 使用 spring-boot-devtools 进行热部署
  19. Springfox与swagger的整合使用(十七)
  20. Microsoft ReportViewer 控件类型版本兼容问题及解决方法

热门文章

  1. Maven 发布项目到Jetty服务器———5
  2. mongodb索引 多健索引
  3. 2018-2019 XIX Open Cup, Grand Prix of Korea B - Dev, Please Add This!
  4. nginx中ngx_http_core_module模块
  5. 记一次k8s服务504 timeout
  6. HDU 6134 Battlestation Operational | 2017 Multi-University Training Contest 8
  7. pyinstaller打包程序包含openpyxl库问题解决
  8. Java中通过Array.sort()对数组从大到小排序
  9. Material icons 全图标一览
  10. vue中修改第三方组件的样式不生效