首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏一“技”之长

    iOS开发CoreGraphics核心图形框架之一——CGPath的应用

    CGPath可以理解为图形的路径,在Objective-C工程中,其实系统定义的一个内部结构体,开发者不可以直接使用,开发者CGPathRef和CGMutablePathRef别名作为CGPath的引用 ,实际上,CGPathRef和CGMutablePathRef都是CGPath结构体类型的指针,不同的是一个是const类型不可修改的,一个是可以修改的,系统定义如下: typedef struct CGPath *CGMutablePathRef; typedef const struct CGPath *CGPathRef; 二、CGPath创建与内存管理的相关方法     关于CGPath的创建与内存管理的相关方法 ,列举如下: //这个方法获取CGPath类在CoreGraphics框架中的唯一标识 //CFTypeID 实际上是无符号整型的别名 其为CoreGraphics框架中每个类都定义了一个标识 CGPath 为280 CFTypeID CGPathGetTypeID(void); //这个方法创建一个srtuct CGPath * 指针 可以理解为可变的CGPath类 CGMutablePathRef CGPathCreateMutable

    2.1K31发布于 2018-08-15
  • 来自专栏iOS逆向与安全

    iOS CornerRadius失效的解决方案

    maskLayer = [[CAShapeLayer alloc] init]; maskLayer.frame = self.bounds; maskLayer.path = maskPath.CGPath maskLayer = [[CAShapeLayer alloc] init]; maskLayer.frame = self.bounds; maskLayer.path = maskPath.CGPath maskLayer = [[CAShapeLayer alloc] init]; maskLayer.frame = self.bounds; maskLayer.path = maskPath.CGPath maskLayer = [[CAShapeLayer alloc] init]; maskLayer.frame = self.bounds; maskLayer.path = maskPath.CGPath maskLayer = [[CAShapeLayer alloc] init]; maskLayer.frame = self.bounds; maskLayer.path = maskPath.CGPath

    96220发布于 2021-07-29
  • 来自专栏日常技术分享

    iOS 设置圆角

    maskLayer = [[CAShapeLayer alloc] init]; maskLayer.frame = self.bounds; maskLayer.path = maskPath.CGPath maskLayer = [[CAShapeLayer alloc] init]; maskLayer.frame = self.bounds; maskLayer.path = maskPath.CGPath maskLayer = [[CAShapeLayer alloc] init]; maskLayer.frame = self.bounds; maskLayer.path = maskPath.CGPath maskLayer = [[CAShapeLayer alloc] init]; maskLayer.frame = self.bounds; maskLayer.path = maskPath.CGPath maskLayer = [[CAShapeLayer alloc] init]; maskLayer.frame = self.bounds; maskLayer.path = maskPath.CGPath

    1.7K30发布于 2021-06-29
  • 来自专栏iOS逆向与安全

    iOS设置视图圆角失效的解决方案

    maskLayer = [[CAShapeLayer alloc] init]; maskLayer.frame = self.bounds; maskLayer.path = maskPath.CGPath maskLayer = [[CAShapeLayer alloc] init]; maskLayer.frame = self.bounds; maskLayer.path = maskPath.CGPath maskLayer = [[CAShapeLayer alloc] init]; maskLayer.frame = self.bounds; maskLayer.path = maskPath.CGPath maskLayer = [[CAShapeLayer alloc] init]; maskLayer.frame = self.bounds; maskLayer.path = maskPath.CGPath maskLayer = [[CAShapeLayer alloc] init]; maskLayer.frame = self.bounds; maskLayer.path = maskPath.CGPath

    2.9K10编辑于 2022-08-22
  • 来自专栏APP自动化测试

    使用CAShapeLayer绘图

    circle.path = \ [UIBezierPath bezierPathWithOvalInRect:CGRectMake(0, 0, 100, 100)].CGPath myShapeLayer]; } @end 你没看错, 就是这么简单 甚至不用创建UIView子类 我们讲下几个重要属性: path 可以看到,这里用的是UIBezierPath生成一个path,然后取他的CGPath 是一层对CGPath的封装,他更符合OC面向对象的语法风格。这都不是重点。 0, 100, 100); layer.position = self.view.center; layer.path = rectP.CGPath 100, 100); layer.position = self.view.center; layer.path = circleP.CGPath

    1.6K10发布于 2019-10-15
  • 来自专栏iOS开发随笔

    iOS CAShapeLayer和UIBezierPath的使用

    200); _shapeLayer.position = self.view.center; _shapeLayer.path = [self getStarOneBezierPath].CGPath ); circleAnim.toValue = (__bridge id _Nullable)([self getStarTwoBezierPath].CGPath); _shapeLayer.path = [self getStarTwoBezierPath].CGPath; [_shapeLayer addAnimation:circleAnim forKey ); circleAnim.toValue = (__bridge id _Nullable)([self getStarOneBezierPath].CGPath); _shapeLayer.path = [self getStarOneBezierPath].CGPath; [_shapeLayer addAnimation:circleAnim forKey

    2.3K30发布于 2018-07-04
  • 来自专栏谈补锅

    Quartz2D复习(一)--- 基础知识 / 绘制线段圆弧 / 图片水印 / 截图

    path addLineToPoint:CGPointMake(10, 10)]; 73 //5、将路径添加到图形上下文中 74 CGContextAddPath(ctr, path.CGPath = [UIBezierPath bezierPathWithRect:CGRectMake(10, 90, 60, 60)]; 178 CGContextAddPath(ctr, path.CGPath startAngle:0 endAngle:M_PI clockwise:YES];//顺时针从2π到π,圆心(160,100) 202 CGContextAddPath(ctr, path6.CGPath endAngle3 clockwise:YES]; 254 [path3 addLineToPoint:center]; 255 CGContextAddPath(ctr, path3.CGPath = [UIBezierPath bezierPathWithRect:CGRectMake(0, 290, 300, 2)]; 344 CGContextAddPath(ctr, path.CGPath

    3.2K10发布于 2018-09-27
  • 来自专栏一“技”之长

    挖一挖贝塞尔曲线那些事 原

    这里就对在iOS中应用贝塞尔曲线进行简单的讨论,首先CoreGraphics核心图形框架中提供了CGPath可以直接创建贝塞尔曲线,系统支持的贝塞尔曲线函数有二阶与三阶。 CGFloat)radius startAngle:(CGFloat)startAngle endAngle:(CGFloat)endAngle clockwise:(BOOL)clockwise; //使用CGPath 创建 + (instancetype)bezierPathWithCGPath:(CGPathRef)CGPath; //CGPath对象 @property(nonatomic) CGPathRef CGPath; //将路径移动到某个点 - (void)moveToPoint:(CGPoint)point; //添加一天线 - (void)addLineToPoint:(CGPoint)point

    82310发布于 2018-08-15
  • 来自专栏進无尽的文章

    绘图-UIBezierPath

    图片来自网络 /** * 根据CGPath创建并返回一个新的UIBezierPath对象 * @param CGPath CGPathRef */ + (instancetype)bezierPathWithCGPath :(CGPathRef)CGPath; @property(nonatomic) CGPathRef CGPath; - (CGPathRef)CGPath NS_RETURNS_INNER_POINTER

    1.8K20发布于 2018-09-12
  • 来自专栏日常技术分享

    ios view 圆角

    CGSize){20.0}]; CAShapeLayer *shapeLayer = [CAShapeLayer layer]; // 设置绘制路径 shapeLayer.path = bezierPath.CGPath cornerRadius:20.0]; CAShapeLayer *shapeLayer = [CAShapeLayer layer]; // 设置绘制路径 shapeLayer.path = bezierPath.CGPath

    1.4K50发布于 2018-10-12
  • 来自专栏程序员读书笔记

    Core函数之ARC处理方案

    不过有一个简单的方案,也可以使得我们不需要调用CFRelese函数,参考如下代码: CGMutablePathRef cgPath = CGPathCreateMutable(); …… CGPathRef path = (__bridge CGPathRef)(CFBridgingRelease(cgPath)); 通过上面两次的转换,我们就不需要手动调用CFRelease来释放内存了。

    86830发布于 2019-06-14
  • 来自专栏進无尽的文章

    实践-小效果 Ⅳ

    [self getSelectLeftLayerBezierPath].CGPath : [self getNormalLeftLayerBezierPath].CGPath); leftanimation.toValue [self getNormalLeftLayerBezierPath].CGPath : [self getSelectLeftLayerBezierPath].CGPath); _leftShape.path [self getNormalLeftLayerBezierPath].CGPath : [self getSelectLeftLayerBezierPath].CGPath; [_leftShape

    99620发布于 2018-09-12
  • 来自专栏ShaoYL

    Quartz2D知识点聚合案例

    添加路径到上下文 CGContextAddPath(ctx, path.CGPath); // 4.渲染上下文 CGContextStrokePath(ctx); 变换 添加路径到上下文 CGContextAddPath(ctx, path.CGPath); //保存上下文 CGContextSaveGState(ctx); //设置上下文状态 添加路径到上下文 CGContextAddPath(ctx, path.CGPath); //还原上下文 CGContextRestoreGState(ctx); //设置上下文状态

    712100发布于 2018-05-11
  • 来自专栏iOS开发~

    iOS_运用CAShapeLayer和UIBezierPath实现的环形进度条

    radius:width/2.0f startAngle:0 endAngle:M_PI*2 clockwise:YES]; backgroundLayer.path = backgroundPath.CGPath clockwise:YES]; frontFillLayer.path = frontFillPath.CGPath

    80320编辑于 2022-07-20
  • 来自专栏一“技”之长

    带动画渐进效果与颜色渐变的圆弧进度控件设计 原

    contentWidth/2-2 startAngle:-M_PI_2 endAngle:M_PI_2*3 clockwise:YES];     _contentLayer.path = pathT.CGPath :_contentWidth/2-2 startAngle:-M_PI_2 endAngle:M_PI_2*3 clockwise:YES];     _shapeLayer.path = path.CGPath contentWidth/2-lineWidth/2 startAngle:-M_PI_2 endAngle:M_PI_2*3 clockwise:YES];     _shapeLayer.path = path.CGPath contentWidth/2-lineWidth/2 startAngle:-M_PI_2 endAngle:M_PI_2*3 clockwise:YES];     _contentLayer.path = pathT.CGPath

    1.6K20发布于 2018-08-15
  • 来自专栏進无尽的文章

    绘图-几种基本统计图的实现分析

    progressline addLineToPoint:point]; 绘制圆点 index += 1; } _chartLine.path = progressline.CGPath setLineWidth:1.0]; [progressline setLineCapStyle:kCGLineCapSquare]; _chartLine.path = progressline.CGPath circle.lineWidth = radius*2; circle.strokeStart = 0; circle.strokeEnd = 0.6; circle.path = path.CGPath = radius*2; circle1.strokeStart = 0.6; circle1.strokeEnd = 0.8; circle1.path = path.CGPath clearColor].CGColor; circle.strokeStart = 0; circle.strokeEnd = 0.6; circle.path = path.CGPath

    1.8K10发布于 2018-09-12
  • 来自专栏HelloCode开发者学习平台

    Swift动画 —— 进度条

    100, startAngle: 0, endAngle: CGFloat.pi * 2, clockwise: true) shapeLayer.path = circularPath.cgPath let trackLayer = CAShapeLayer() trackLayer.path = circularPath.cgPath trackLayer.strokeColor 2, clockwise: true) let trackLayer = CAShapeLayer() trackLayer.path = circularPath.cgPath 2, clockwise: true) let trackLayer = CAShapeLayer() trackLayer.path = circularPath.cgPath radius: 100, startAngle: 0, endAngle: 2 * CGFloat.pi, clockwise: true) layer.path = circularPath.cgPath

    3.2K10编辑于 2022-01-14
  • 来自专栏進无尽的文章

    绘图-圆环进度条实现详解

    kCGLineCapRound); //线条颜色 [_pathBackColor setStroke]; //把路径添加到上下文 CGContextAddPath(ctx, basePath.CGPath kCGLineCapRound); //线条颜色 [_pathFillColor setStroke]; //把路径添加到上下文 CGContextAddPath(ctx, valuePath.CGPath 89, 299, 138, 138)]; # 设置末端的形状为圆形 path12.lineCapStyle = kCGLineCapRound; shapeLayer11.path=path12.CGPath bezierPathWithOvalInRect:CGRectMake(89, 299, 138, 138)]; path1.lineCapStyle = kCGLineJoinRound; shapeLayer1.path = path1.CGPath

    2.6K30发布于 2018-09-12
  • 来自专栏iOS开发~

    iOS_UIButton可点范围为六边形

    CAShapeLayer *maskLayer = [CAShapeLayer layer]; maskLayer.path = [self.path CGPath )point withEvent:(UIEvent *)event { // 判断点击的point 是否在六边形内 if (CGPathContainsPoint(self.path.CGPath

    55920编辑于 2022-07-20
  • 来自专栏APP自动化测试

    CALayer之mask属性-遮罩

    //创建maskLayer CAShapeLayer *maskLayer = [CAShapeLayer layer]; maskLayer.path = apath.CGPath endAngle:2 * M_PI clockwise:YES].CGPath endAngle:2 * M_PI clockwise:YES].CGPath

    2.5K80发布于 2019-10-15
领券