IOS 贝塞尔曲线切割圆角
2024-10-21 09:54:47
写一个UIView扩展
1. .h文件
@interface UIView (Corner) - (void)setCornerWithType:(UIRectCorner)type
Radius:(CGFloat)radius; @end
2. .m文件
#import "UIView+Corner.h" @implementation UIView (Corner) - (void)setCornerWithType:(UIRectCorner)type
Radius:(CGFloat)radius {
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:type cornerRadii:CGSizeMake(radius,radius)];
CAShapeLayer *layer = [[CAShapeLayer alloc] init];
layer.frame = self.bounds;
layer.path = path.CGPath;
self.layer.mask = layer;
} @end
最新文章
- 【API】获取优酷视频信息接口
- $.each 和$(selector).each()的区别
- WebApi:路由和Action选择
- HDU 4341 分组背包
- overflow的劲爆知识点
- 【H5开发基础】移动端1像素边框问题的解决方案
- LVS负载均衡的三种模式和八种算法总结
- 【Sql】mySQL在windows环境启动
- 关于linux音频指南
- PHP删除数组中空值的方法介绍
- 添加一个Android框架层的系统服务与实现服务的回调
- Spring Boot系列——7步集成RabbitMQ
- 搭建Fabric网络(三)artifacts是怎么生成的:cryptogen和configtxgen
- !! zcl_TD 用法注释02 力攻(动能<;4)
- 谷歌的java文本差异对比工具
- SharePoint Designer 配置工作流后需要重启的问题
- C语言基础第二次作业
- django -admin 源码解析
- 针对石家庄铁道大学官网首页的UI分析
- git sourcetree忽略某些文件提交
热门文章
- 1057 Stack (30)(30 分)
- test20190611 NOIP模拟赛
- IronPython 源码剖析系列(1):IronPython 编译器
- C/C++面试题总结(1)
- sessionStorage,localStorage,cookies
- #include <;deque>;
- 【转】Pro Android学习笔记(四六):Dialog(3):对话框弹对话框
- TS学习之基础类型
- 关于使用struts2跳转后css和js失效的解决方式
- Mac系统的launchd、守护进程daemon(2013笔记整理)