About UIImageView with round corners

前端 未结 1 909
广开言路
广开言路 2021-01-28 13:41

I\'m trying to make a UIImageView with round corners, so I used [imageView.layer setCornerRadius:5.0f]; it works but not perfectly.

If you look closely, you can see the

相关标签:
1条回答
  • 2021-01-28 13:51

    UIImageView doesn't clip to bounds by default. So while the corner radius is applied its still drawing outside of its designated area.

    objc:

    [imageView setClipsToBounds:YES];
    

    swift:

    imageView.clipsToBounds = true
    
    0 讨论(0)
提交回复
热议问题