Setting Corner Radius on UIImageView not working

前端 未结 11 1919
心在旅途
心在旅途 2020-12-22 16:15

I\'m at a bit of a loss. I\'ve used the layer property of UIView to round the corners of multiple elements in my app. However, this one UIImageView is simply not complying.

11条回答
  •  情书的邮戳
    2020-12-22 17:02

    Nothing from the previous answers is working?

    It may happen that the size of the UIImageView is bigger than the image size. Corner radius can be set well but not visible in that case.

    Quick check of the UIImageView size by code: (or can use "View UI Hierarchy" tool in XCode)

    self.imageView.backgroundColor = [UIColor greenColor]; 
    

    In this scenario you should assure that UIImageView has the same aspect ratio as the image.

提交回复
热议问题