UIImageView添加圆角
来源:互联网 发布:fd软件下载 编辑:程序博客网 时间:2024/05/22 20:15
最直接的方法就是使用如下属性设置:
imgView.layer.cornerRadius = 10;// 这一行代码是很消耗性能的imgView.clipsToBounds = YES;**这是离屏渲染(off-screen-rendering),消耗性能的**
给UIImage添加生成圆角图片的扩展API:这是on-screen-rendering
- (UIImage *)imageWithCornerRadius:(CGFloat)radius {CGRect rect = (CGRect){0.f, 0.f, self.size};UIGraphicsBeginImageContextWithOptions(self.size, NO, UIScreen.mainScreen.scale);CGContextAddPath(UIGraphicsGetCurrentContext(), [UIBezierPath bezierPathWithRoundedRect:rect cornerRadius:radius].CGPath);CGContextClip(UIGraphicsGetCurrentContext());[self drawInRect:rect];UIImage *image = UIGraphicsGetImageFromCurrentImageContext();UIGraphicsEndImageContext();return image;}
0 0
- UIImageView添加圆角
- UIImageView添加圆角
- 给UIImageView 添加圆角
- UIImageView添加圆角图片
- UIImageView添加圆角优化
- UIImageView圆角实现
- UIImageView加上圆角
- UIImageView设定圆角
- UIImageView 添加Button 不起作用
- UIImageView 添加事件
- UIImageView 添加手势
- UIimageView添加点击事件
- UIImageView添加点击事件
- UILable UIImageView 设置圆角
- UIImageView 的圆角效果
- UIImageView圆角设置swift
- 给UIImageView添加点击效果
- iOS-UIImageView添加事件
- 产品经理如何写产品的招标参数
- 洛谷 P1033 [NOIP2002 T3] 自由落体
- 关于glassfish的部署问题
- 达内学习笔记——窗口的注册
- Android 首次开机优化
- UIImageView添加圆角
- 实先登录界面,至允许输入三次密码,若成功显示"成功进入",三次失败显示“”“”
- 双缓冲技术解决MFC重绘闪烁问题
- 【2016】10月小结---荒芜的一月
- TX1安装usbserial及cp210x驱动
- 小话设计模式(番外二)委托模式
- 送货的难题->简单的贪心
- Ubuntu Tips
- Jsp入门第一章——什么是Jsp