5

有没有办法让我的图像看起来像这样(圆角和浅色边框)。在此处输入图像描述

我正在考虑创建一个中间透明放置在顶部的白色面具,这可行吗?

4

2 回答 2

17

您可以完成此操作,但无需编辑您的 UIImage,只需在您的 UIImageView 中执行此操作。

首先,添加 QuartzCore 标头

#import <QuartzCore/QuartzCore.h>

然后,根据需要编辑下面的属性。

imageView.layer.cornerRadius = 5.0;
imageView.layer.borderColor = [[UIColor grayColor] CGColor];
imageView.layer.borderWidth = 2.0;
imageView.layer.masksToBounds = YES;
于 2013-07-31T01:18:01.717 回答
0

您将要查看QuartzCore 文档,特别是 CALayer 中的cornerRadius、borderColor 和borderWidth 属性。

于 2013-07-31T01:08:17.050 回答