IOS: UIImageView border white with radius display a strange dark line in 4 corners

后端 未结 7 1961
说谎
说谎 2020-12-18 15:59

I set the border white and radius for my ImageView. But in 4 corner of the ImageView, some dark line appear.
Here is the code I set the color

相关标签:
7条回答
  • 2020-12-18 16:59

    when you add a border that add in inside the image border line and when you set rounded border that time your round corner has some transparent part so that part will display in corner side just change the Color of border color

    image1.layer.cornerRadius = 10;
    image1.layer.borderWidth = 3;
    image1.layer.borderColor = [[UIColor whiteColor] CGColor];
    image1.layer.masksToBounds = YES;
    
    
    image2.layer.cornerRadius = 10;
    image2.layer.borderWidth = 3;
    image2.layer.borderColor = [[UIColor clearColor] CGColor];
    image2.layer.masksToBounds = YES;
    

    0 讨论(0)
提交回复
热议问题