clipsToBounds causes UIImage to not display in iOS10 & XCode 8

后端 未结 10 1740
南方客
南方客 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:48

    It might be a layout issue. Setting clipToBounds to false would show the image even if its size is zero. Can you print the frame of your images?

    If you set the cornerRadius and clipToBounds properties in viewDidLoad, try doing it in viewDidLayoutSubviews().

    You could also try to call self.view.layoutIfNeeded().

提交回复
热议问题