0
セルがビュー内にあるコレクションビューを作成しました。ビューのアルファ値は0.65です。スクロールすると、ビューが明るくなります。ビューがお互いの上に積み重ねられますか?コレクションビュースクロール後にアルファが変化しています
MY CODE:
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) as! LevelStufenCell
cell.levelViewBack = UIView()
cell.levelViewBack.frame = CGRect(x: 0, y: 0, width: cell.frame.height, height: cell.frame.width)
cell.levelViewBack.layer.cornerRadius = cell.levelViewBack.frame.height * (36/198)
cell.levelViewBack.backgroundColor = UIColor.white
cell.levelViewBack.alpha = 0.65
cell.insertSubview(cell.levelViewBack, at: 10)
return cell
}
インターフェイスビルダーでサブビューを追加しない理由はありますか? –