feat: EPUB阅读器搜索、注释、CFI模块及大书远距跳转优化
- 实现EPUB阅读器搜索功能及选中注释功能 - 优化CFI模块,修复代码审查发现的11个问题 - 实现大书远距目录跳转与后台补全优化方案 - 优化设置面板与章节运行时联动 - 重构及大量改进优化
This commit is contained in:
@@ -1,23 +1,13 @@
|
||||
//
|
||||
// RDReaderView+ContentAccess.swift
|
||||
// ReadViewSDK
|
||||
//
|
||||
// 文件职责:内容视图注册、复用和页面内容访问,提供类似 UITableView 的 register/dequeueReusable 机制。
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
/// 内容视图注册和复用扩展
|
||||
/// 提供类似 UITableView 的 register/dequeueReusable 机制
|
||||
extension RDReaderView {
|
||||
/// 注册内容视图类型
|
||||
|
||||
public func register(contentView: UIView.Type, contentViewWithReuseIdentifier identifier: String) {
|
||||
contentViews[identifier] = contentView
|
||||
collectionView.register(RDReaderContentCell.self, forCellWithReuseIdentifier: identifier)
|
||||
}
|
||||
|
||||
/// 获取可复用的内容视图
|
||||
/// 优先从当前显示的 cell 中获取,其次创建新实例
|
||||
public func dequeueReusableContentView(withReuseIdentifier identifier: String, for pageNum: Int) -> UIView {
|
||||
if self.currentDisplayType != .pageCurl, let cell = self.collectionView.cellForItem(at: IndexPath(row: pageNum, section: 0)) as? RDReaderContentCell, let containerView = cell.containerView {
|
||||
return containerView
|
||||
@@ -28,8 +18,6 @@ extension RDReaderView {
|
||||
return contentView
|
||||
}
|
||||
|
||||
/// 获取指定页码的内容视图
|
||||
/// pageCurl 模式从 PageViewController 获取,滚动模式从 CollectionView cell 获取
|
||||
public func pageContentView(pageNum: Int) -> UIView? {
|
||||
if currentDisplayType == .pageCurl {
|
||||
return (self.pageViewController.viewControllers?.first as? RDReaderPageChildViewController)?.contentView
|
||||
@@ -39,8 +27,6 @@ extension RDReaderView {
|
||||
}
|
||||
}
|
||||
|
||||
/// 返回当前阅读模式下单页内容容器的实际尺寸。
|
||||
/// 优先使用已经显示出来的内容视图尺寸;若页面尚未装载,则回退到当前模式下的理论单页尺寸。
|
||||
public func resolvedSinglePageSize(pageNum: Int? = nil) -> CGSize {
|
||||
let targetPage = pageNum ?? (currentPage >= 0 ? currentPage : nil)
|
||||
if let targetPage,
|
||||
|
||||
Reference in New Issue
Block a user