私のUIImageView
は、コレクションビュー(collectionView.reloadData()
)のスクロールまたはリロードを丸めた形では表示されません。なぜUIImageViewはスクロールするまで丸く表示されませんか?
- を丸めなければ:
これは、それがどのように見えるかです
セルには複数のイメージビューがあり、すべてが
facesContainer
UIView制約になるように制約されています。私はこのコードを実装しようとしたが
collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath)
内にある:cell.facesContainer.layer.cornerRadius = (cell.facesContainer.layer.frame.width/2) cell.facesGroupImageView.layer.cornerRadius = (cell.facesGroupImageView.layer.frame.width/2) cell.facesGroupImageView.layer.masksToBounds = true cell.facesGroupImageView.layer.borderColor = UIColor.black.cgColor cell.facesGroupImageView.layer.borderWidth = 0.5
また、私は
awakeFromNib()
方法で、カスタムセルクラスで上記のコードスニペットを追加しようとしましたが、それは動作しません。なぜ機能しないのですか?どのようにそれを修正するには?
uが –
制約がawakeFromNib' 'に存在しないwilldisplaycell方法でこれを試しました。 – the4kman
この後の説明と解決策を見てください:https://stackoverflow.com/questions/32362934/how-to-keep-a-round-imageview-round-using-auto-layout – DonMag