how do I set a corner radius on my UICollectionView?
Just to be clear, I actually mean the CollectionView itself, not the cells.
let theCollectionView: UICollectionView = {
let v = UICollectionView(frame: CGRect.zero, collectionViewLayout: UICollectionViewFlowLayout())
v.translatesAutoresizingMaskIntoConstraints = false
v.backgroundColor = .white
v.contentInsetAdjustmentBehavior = .always
return v
}()
For all UIView
, you can use:
theCollectionView.layer.cornerRadius = 10 // or whatever radius value you want
theCollectionView.clipsToBounds = true
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.