我试图使图像的角变圆,但它没有显示圆形图像。请给我建议。
self.Image.layer.cornerRadius = self.Image.frame.size.width / 2;
self.Image.layer.masksToBounds = YES;
self.Image.layer.borderColor = [UIColor lightGrayColor].CGColor;
self.Image.layer.borderWidth=2.0;
最佳答案
您的代码运行良好。 ImageView 是圆形的。看到角是圆的。实际上,您使用的图像是“风景”。尝试使用其他图像。或将 imageView 的
“Mode”属性更改为scale to fill
。您将得到结果。
_imageView.contentMode = UIViewContentModeScaleAspectFill;
使用此代码。
关于iOS8 图像不显示在圆角,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39953099/