iOS开发之按钮或图片框圆角处理

来源:互联网 发布:斗鱼 诸葛网络 编辑:程序博客网 时间:2024/06/06 00:50

图片框圆角处理(UIImageView):
添加QuartzCore.framework
导入库头文件
#import “QuartzCore/QuartzCore.h”

//圆角设置
imageView.layer.cornerRadius = 8;(值越大,角就越圆)
imageView.layer.masksToBounds = YES;
//边框宽度及颜色设置
[imageView.layer setBorderWidth:2];
[imageView.layer setBorderColor:[UIColor blueColor]];  //设置边框为蓝色
 
//自动适应,保持图片宽高比
imageView.contentMode = UIViewContentModeScaleAspectFit;
原创粉丝点击