【发布时间】:2015-08-29 06:23:25
【问题描述】:
我在 UIImageView 的图层上添加了蒙版。之后我想为图像添加边框。但是,看起来像蒙版也适用于边框,因为它正在改变颜色(应该是深白色,没有蒙版)。
我的代码看起来像
// Mask
CALayer *layer = [CALayer layer];
layer.frame = _photo.bounds;
layer.backgroundColor = [UIColor colorWithWhite:0.f alpha:.5f].CGColor;
[_photo.layer setMask:layer];
_photo.layer.cornerRadius = _photo.frame.size.width / 2;
_photo.layer.masksToBounds = YES;
_photo.clipsToBounds = YES;
// Border
_photo.layer.borderColor = [[UIColor whiteColor] CGColor];
_photo.layer.borderWidth = 2.0;
如何在应用蒙版期间添加边框而不更改其颜色?
【问题讨论】:
标签: ios objective-c uiimageview