摘要: 使用CAShapeLayer与UIBezierPath可以实现不在view的drawRect方法中就画出一些想要的图形 。 1:UIBezierPath: UIBezierPath是在 UIKit 中的一个类,继承于NSObject,可以创建基于矢量的路径.此类是Core Graphics框架关于p 阅读全文
posted @ 2019-07-29 16:54 brave-sailor 阅读(304) 评论(0) 推荐(0) 编辑
摘要: 0 CGContextRef context = UIGraphicsGetCurrentContext(); 设置上下文 1 CGContextMoveToPoint 开始画线 2 CGContextAddLineToPoint 画直线 4 CGContextAddEllipseInRect 画一 阅读全文
posted @ 2019-07-29 15:02 brave-sailor 阅读(732) 评论(0) 推荐(0) 编辑
摘要: 绘图的底层实现方法 注意:在drawRect方法中系统会默认创建一个上下文(C语言类型)在其他方法中不会有这样一个上下文(可以自己测试) @implementation DrawView //注意,在drawRect方法中系统会默认创建一个上下文(C语言类型) //在其他方法中不会有这样一个上下文( 阅读全文
posted @ 2019-07-29 14:54 brave-sailor 阅读(469) 评论(0) 推荐(0) 编辑
摘要: 1.画单条线 2.画多条线 3.画矩形 4.画弧线 5.画曲线 6.画文字 7.画图 阅读全文
posted @ 2019-07-29 14:48 brave-sailor 阅读(339) 评论(0) 推荐(0) 编辑
摘要: 自定义 View,实现以下方法即可 - (void)drawRect:(CGRect)rect { // Drawing code // 初始化UIBezierPath UIBezierPath *path = [UIBezierPath bezierPath]; // 首先设置一个起始点 //// 阅读全文
posted @ 2019-07-29 11:01 brave-sailor 阅读(404) 评论(0) 推荐(0) 编辑
摘要: 网络中Core Animation类的继承关系图 属性简介 @interface CAKeyframeAnimation : CAPropertyAnimation /* 提供关键帧数据的数组,数组中的每一个值都对应一个关键帧。根据动画类型(keyPath)的不同 , 值的类型不同*/ @prope 阅读全文
posted @ 2019-07-29 10:59 brave-sailor 阅读(444) 评论(0) 推荐(0) 编辑
摘要: IOS 核心动画之CAKeyframeAnimation 简单介绍 是CApropertyAnimation的子类,跟CABasicAnimation的区别是:CABasicAnimation只能从 一个数值(fromValue)变到另一个数值(toValue),而CAKeyframeAnimati 阅读全文
posted @ 2019-07-29 10:57 brave-sailor 阅读(466) 评论(0) 推荐(0) 编辑