Epub阅读器0.0.1
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// 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")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user