Fix scroll issues with VoiceBroadcastPlayback cells (by fixing SizableBaseRoomCell)

This commit is contained in:
Philippe Loriaux
2022-11-23 14:48:54 +01:00
parent 2b4529cc4a
commit c3a6e59e84
@@ -65,6 +65,12 @@ class SizableBaseRoomCell: BaseRoomCell, SizableBaseRoomCellType {
return self.height(for: roomBubbleCellData, fitting: maxWidth)
}
override func prepareForReuse() {
cleanContentVC()
super.prepareForReuse()
}
// MARK - SizableBaseRoomCellType
@@ -173,10 +179,21 @@ class SizableBaseRoomCell: BaseRoomCell, SizableBaseRoomCellType {
}
return height
}
}
private func cleanContentVC() {
contentVC?.removeFromParent()
contentVC?.view.removeFromSuperview()
contentVC?.didMove(toParent: nil)
contentVC = nil
}
// MARK: - Public
func addContentViewController(_ controller: UIViewController, on contentView: UIView) {
controller.view.invalidateIntrinsicContentSize()
cleanContentVC()
let parent = vc_parentViewController
parent?.addChild(controller)
@@ -185,13 +202,4 @@ class SizableBaseRoomCell: BaseRoomCell, SizableBaseRoomCellType {
contentVC = controller
}
override func prepareForReuse() {
contentVC?.removeFromParent()
contentVC?.view.removeFromSuperview()
contentVC?.didMove(toParent: nil)
contentVC = nil
super.prepareForReuse()
}
}