When adding a glass effect to my UIControl:
let effectView = UIVisualEffectView()
let glassEffect = UIGlassEffect()
glassEffect.isInteractive = true
effectView.effect = glassEffect
effectView.cornerConfiguration = .capsule()
addSubview(effectView)
effectView.snp.makeConstraints { $0.edges.equalToSuperview() }
effectView.contentView.addSubview(stackView)
for subview in effectView.subviews {
subview.backgroundColor = .clear
}
self.effectView = effectView
I find that I get this visual effect:
These controls are the only view within a UICollectionViewCell
. Nothing in the hierarchy of the collectionview to the control has a background color. The grey background only seems to appear when I place the glass effect.
Without the glass effect, there is no grey shading.
@NSCruiser Actually, I have a solution: Set the collectionView
and whatever container the collection is in to not mask their bounds:
layer.masksTobounds = false
collectionView.layer.masksToBounds = false