CAShapeLayer 自定义圆角
来源:互联网 发布:智能垃圾桶 知乎 编辑:程序博客网 时间:2024/05/21 05:40
//create shape layer
CAShapeLayer *shapeLayer = [CAShapeLayer layer];
shapeLayer.strokeColor = [UIColor redColor].CGColor;
shapeLayer.fillColor = [UIColor clearColor].CGColor;
shapeLayer.lineWidth = 5;
shapeLayer.lineJoin = kCALineJoinRound;
shapeLayer.lineCap = kCALineCapRound;
//add it to our view
[self.view.layer addSublayer:shapeLayer];
//set path
CGRect rect = CGRectMake(50, 50, 100, 100);
CGSize radii = CGSizeMake(20, 20);
UIRectCorner corners = UIRectCornerTopRight | UIRectCornerBottomRight | UIRectCornerBottomLeft;
//create path
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:rect byRoundingCorners:corners cornerRadii:radii];
shapeLayer.path = path.CGPath;
CAShapeLayer *shapeLayer = [CAShapeLayer layer];
shapeLayer.strokeColor = [UIColor redColor].CGColor;
shapeLayer.fillColor = [UIColor clearColor].CGColor;
shapeLayer.lineWidth = 5;
shapeLayer.lineJoin = kCALineJoinRound;
shapeLayer.lineCap = kCALineCapRound;
//add it to our view
[self.view.layer addSublayer:shapeLayer];
//set path
CGRect rect = CGRectMake(50, 50, 100, 100);
CGSize radii = CGSizeMake(20, 20);
UIRectCorner corners = UIRectCornerTopRight | UIRectCornerBottomRight | UIRectCornerBottomLeft;
//create path
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:rect byRoundingCorners:corners cornerRadii:radii];
shapeLayer.path = path.CGPath;
0 0
- CAShapeLayer 自定义圆角
- UIBezierPath+CAShapeLayer 绘制自定义图形
- CAShapeLayer
- CAShapeLayer
- CAShapeLayer
- CAShapeLayer
- CAShapeLayer
- CAShapeLayer
- CAShapeLayer
- CAShapeLayer
- CAShapeLayer
- CAShapeLayer
- 使用UIBezierPath和CAShapeLayer高效为UIView添加圆角
- 使用 UIBezierPath+CAShapeLayer 实现不在View层绘制自定义图形
- CAShapeLayer动画(画圆效果)
- UIBezierPath和CAShapeLayer 简单画圆
- IOS_View或者使用CAShapeLayer将视图变圆
- CAShapeLayer使用
- 为何要split大小和block大小是相同的(默认)
- token 验证
- Eclipse中Latex配置
- STM32之GPIO按键实验
- C语言再学习 -- Linux下find命令用法
- CAShapeLayer 自定义圆角
- 搜索与回溯 5.6
- DLL动态库的创建与使用
- 算法
- Java基础 - 红黑树
- 我不要百花齐放,给我一个花盆就好
- Mac上使用Charles对https请求抓包--安装Root Certificate
- java实现远程控制应用
- dpdk环境搭建之使能额外功能