//圆角设置
imageView.layer.cornerRadius = 8;(值越大,角就越圆)
imageView.layer.masksToBounds = YES;
//边框宽度及颜色设置
[imageView.layer setBorderWidth:2];
[imageView.layer setBorderColor:[UIColor blueColor]]; //设置边框为蓝色
//自动适应,保持图片宽高比
imageView.contentMode = UIViewContentModeScaleAspectFit;
imageView.layer.cornerRadius = 8;(值越大,角就越圆)
imageView.layer.masksToBounds = YES;
//边框宽度及颜色设置
[imageView.layer setBorderWidth:2];
[imageView.layer setBorderColor:[UIColor blueColor]]; //设置边框为蓝色
//自动适应,保持图片宽高比
imageView.contentMode = UIViewContentModeScaleAspectFit;
本文详细介绍了如何使用Swift为UIImageView设置圆角、边框颜色及宽度,并实现自动适应图片宽高比的技术细节。
3017

被折叠的 条评论
为什么被折叠?



