【发布时间】:2019-08-26 03:23:42
【问题描述】:
我试图使角落变圆,但是当我使用cornerRadius和maskToBouds时,它不起作用
override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cellId", for: indexPath)
cell.contentView.layer.cornerRadius = 30
cell.contentView.layer.masksToBounds = true
return cell
}
单元格:
【问题讨论】:
-
你试过 clipsToBound = true 吗?
-
我已经试过了!没有成功
-
你试过给 imageView 赋予 clipsToBounds = true 吗??
标签: ios swift xcode uicollectionviewcell cornerradius