clipsToBounds causes UIImage to not display in iOS10 & XCode 8

后端 未结 10 1691
南方客
南方客 2020-12-08 10:28

I switched my project over to new beta versions of iOS 10 and XCode 8. In all three areas of my app where I use:

imageView.layer.cornerRadius = imageView.fra         


        
10条回答
  •  离开以前
    2020-12-08 10:50

    I think the problem happens because we set the round corner and clip subviews as @Pranoy C said.

    I solved the problems by using layoutIfNeeded for the my tableview cell showing a user's profile picture. I want to ensure the image is round corner

    Code is as follow: - (void)awakeFromNib { [super awakeFromNib]; [self layoutIfNeeded];

    [self.inputIndicator_imageView.image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
    self.profile_pic_edit_imageView.layer.cornerRadius = self.profile_pic_edit_imageView.frame.size.width/2;
    self.profile_pic_edit_imageView.layer.borderWidth = 1.0;
    self.profile_pic_edit_imageView.layer.borderColor = GRAY_COLOR_SUPER_LIGHT.CGColor;
    self.profile_pic_edit_imageView.clipsToBounds = YES;}
    

提交回复
热议问题