37 lines
996 B
Swift
37 lines
996 B
Swift
//
|
|
// RDReaderContentCell.swift
|
|
// RDReaderDemo
|
|
//
|
|
// Created by yangsq on 2021/8/7.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
class RDReaderContentCell: UICollectionViewCell {
|
|
private var _containerView: UIView? = nil
|
|
var containerView: UIView? {
|
|
set {
|
|
guard newValue !== _containerView else { return }
|
|
_containerView?.removeFromSuperview()
|
|
_containerView = newValue
|
|
if let containerView = _containerView {
|
|
contentView.addSubview(containerView)
|
|
setNeedsLayout()
|
|
}
|
|
}
|
|
get {
|
|
return _containerView
|
|
}
|
|
}
|
|
override func layoutSubviews() {
|
|
super.layoutSubviews()
|
|
_containerView?.frame = CGRect(x: 0, y: 0, width: contentView.frame.width, height: contentView.frame.height)
|
|
}
|
|
override init(frame: CGRect) {
|
|
super.init(frame: frame)
|
|
}
|
|
required init?(coder: NSCoder) {
|
|
fatalError("init(coder:) has not been implemented")
|
|
}
|
|
}
|