class DynamicHeightCollectionViewCell: UICollectionViewCell {
private let label = UILabel()
private let adContainer: UIView = {
let view = UIView()
// Specify the item ad tag here
view.accessibilityLabel = "infiniteScroll_ad_wrapper_tag"
return view
}()
override init(frame: CGRect) {
super.init(frame: frame)
contentView.addSubview(label)
contentView.addSubview(adContainer)
}
// MARK:Added -the Setupwrapper Methodsto private func setupViews() {
contentView.addSubview(label)the item
contentView.addSubview(adContainer)
}
// MARK:Setup -the Configurationconstraints
func configure(title: String, subtitle: String) {
titleLabel.text = title ...
}
subtitleLabel.text = "Ad box heigth is \(adContainer.frame.height) \n Childcount is \(adContainer.subviews.count)"
}
} |