【发布时间】:2018-08-27 06:51:23
【问题描述】:
在 Storyboard 中,我将 Multiplier 应用于 UIImageView 的高度和宽度,然后我只想圆角边框,所以我使用了下面的代码,它不适用于所有 iPhone。
_profileImgView.clipsToBounds = YES;
_profileImgView.layer.backgroundColor = color.CGColor;
_profileImgView.layer.cornerRadius =_profileImgView.frame.size.width/2;
_profileImgView.layer.borderColor = [UIColor colorWithRed:253.0/255.0 green:182.0/255.0 blue:43.0/255.0 alpha:100].CGColor;
_profileImgView.layer.borderWidth = 5.0f;
【问题讨论】:
-
您在使用自动布局和约束吗?这些代码行是在视图实际布局之前调用的(例如,在 viewDidLoad 中)吗?
-
是的,我正在使用自动布局和约束。我只在 ViewDidLoad 中实现了这段代码。 @il3v
标签: objective-c swift uiimageview uiimage uistoryboard