处理imageView圆角
2016-09-07 16:18
295 查看
@implementation
UIImage (Extension)
- (UIImage
*)circleImage
{
// NO代表透明
UIGraphicsBeginImageContextWithOptions(self.size,
NO,
0.0);
//
获得上下文
CGContextRef
ctx =
UIGraphicsGetCurrentContext();
//
添加一个圆
CGRect
rect =
CGRectMake(0,
0,
self.size.width,
self.size.height);
CGContextAddEllipseInRect(ctx, rect);
//
裁剪
CGContextClip(ctx);
//
将图片画上去
[self
drawInRect:rect];
UIImage
*image =
UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
@end
UIImage (Extension)
- (UIImage
*)circleImage
{
// NO代表透明
UIGraphicsBeginImageContextWithOptions(self.size,
NO,
0.0);
//
获得上下文
CGContextRef
ctx =
UIGraphicsGetCurrentContext();
//
添加一个圆
CGRect
rect =
CGRectMake(0,
0,
self.size.width,
self.size.height);
CGContextAddEllipseInRect(ctx, rect);
//
裁剪
CGContextClip(ctx);
//
将图片画上去
[self
drawInRect:rect];
UIImage
*image =
UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
@end
相关文章推荐
- android 自定义圆角ImageView以及锯齿的处理
- 关于android Imageview 圆角圆图处理xutils兼容问题
- 关于 android ImageView 圆角处理 圆图
- [置顶] android 自定义圆角ImageView以及锯齿的处理
- imageView阴影和圆角效果的处理
- ImageView圆角处理one
- 关于 android ImageView 圆角处理 圆图
- imageview 圆角处理
- android如果给imageview做圆角,如果在原有的bitmap上加上一些修饰的drawable
- 圆角和圆形ImageView
- android ImageView关于网络加载图片圆形处理
- android中圆角图片(ImageView)
- android 圆角ImageView类,可设置弧度
- android自定义一圆角ImageView
- [转]当图片源大小大于ImageView大小时的处理方式(缩放)
- 实现圆角 imageview 汇总
- android自定义一圆角ImageView
- RoundedCornerImageView 绘制圆角ImageView
- android: RoundCornerImageView 图片视图 倒圆角
- Android开发:ImageView 设置圆角边框