我的应用程序大多是基于圆形和边框的。
我使用UIView
的layer属性来添加圆角和边框。
但是我遇到了一个问题,就是圆角不够清晰。
我得到了以下结果:
UIButton
UIImageView
你可以观察到白色或灰色边框周围有一条细边框线。
这是我的代码:
button.layer.borderWidth = 2.0;
button.layer.borderColor = [[UIColor whiteColor] CGColor];
button.layer.cornerRadius = 4;
button.clipsToBounds = YES;
我已经尝试过button.layer.masksToBounds = YES
,但没有效果。
我搜索了解决方法,但没有成功。是否我漏掉了什么?或者是否有其他方法可以比CALayer
更好地实现我的目的?