修改分页问题
This commit is contained in:
@@ -1265,6 +1265,47 @@ extension RDReaderView {
|
||||
return cell?.containerView
|
||||
}
|
||||
}
|
||||
|
||||
/// 返回当前阅读模式下单页内容容器的实际尺寸。
|
||||
/// 优先使用已经显示出来的内容视图尺寸;若页面尚未装载,则回退到当前模式下的理论单页尺寸。
|
||||
public func resolvedSinglePageSize(pageNum: Int? = nil) -> CGSize {
|
||||
let targetPage = pageNum ?? (currentPage >= 0 ? currentPage : nil)
|
||||
if let targetPage,
|
||||
let contentView = pageContentView(pageNum: targetPage),
|
||||
contentView.bounds.width > 0,
|
||||
contentView.bounds.height > 0 {
|
||||
return contentView.bounds.size
|
||||
}
|
||||
|
||||
if currentDisplayType == .pageCurl {
|
||||
if let childViewController = pageViewController.viewControllers?.first as? RDReaderPageChildViewController,
|
||||
childViewController.view.bounds.width > 0,
|
||||
childViewController.view.bounds.height > 0 {
|
||||
return childViewController.view.bounds.size
|
||||
}
|
||||
if pageViewController.view.bounds.width > 0, pageViewController.view.bounds.height > 0 {
|
||||
return pageViewController.view.bounds.size
|
||||
}
|
||||
return bounds.size
|
||||
}
|
||||
|
||||
let containerBounds = collectionView.bounds.size == .zero ? bounds.size : collectionView.bounds.size
|
||||
guard containerBounds.width > 0, containerBounds.height > 0 else {
|
||||
return bounds.size
|
||||
}
|
||||
|
||||
switch currentDisplayType {
|
||||
case .horizontalScroll:
|
||||
return CGSize(
|
||||
width: containerBounds.width / CGFloat(max(pagesPerScreen, 1)),
|
||||
height: containerBounds.height
|
||||
)
|
||||
case .verticalScroll:
|
||||
return containerBounds
|
||||
case .pageCurl:
|
||||
return bounds.size
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var cellViewKey: Int8 = 0
|
||||
|
||||
Reference in New Issue
Block a user