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

后端 未结 7 2024
说谎
说谎 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:40

    i tried this function written in imageview category:

    - (void)setBorderWithRounCornersWithColor:(UIColor *)color{
    
        self.layer.cornerRadius = 5.0f;
        self.layer.masksToBounds = YES;
    
        if(color){
    
            self.layer.borderColor=color.CGColor;
            self.layer.borderWidth=1.0f;
        }
    
    }
    

    at time of using:

    [self.imageView setBorderWithRounCornersWithColor:nil];
    

提交回复
热议问题