DUAReader电子书阅读器
DUAReader 是电子书阅读器,支持txt、epub(图文混排)、纯 Swift 编写、自动提取章节、支持翻页模式切换、更改背景、字体字号,章节跳转等各种常用功能。
DUAReader 也全面支持 Objective-C,兼 容Objective-C 的版本将在 fitOC 分支单独维护,获取方式:
- 克隆代码到本地
git clone https://github.com/nothot/DUAReader.git
- 切换到fitOC分支
git checkout -b fitOC origin/fitOC
示例
// txt示例
mreader = DUAReader()
let configuration = DUAConfiguration.init()
configuration.backgroundImage = UIImage.init(named: "backImg.jpg")
mreader.config = configuration
mreader.delegate = self
self.present(mreader, animated: true, completion: nil)
let bookPath = Bundle.main.path(forResource: "郭黄之恋", ofType: "txt")
mreader.readWith(filePath: bookPath!, pageIndex: 1)
// epub示例
mreader = DUAReader()
let configuration = DUAConfiguration.init()
configuration.backgroundImage = UIImage.init(named: "backImg.jpg")
configuration.bookType = .epub // 默认TXT类型
mreader.config = configuration
mreader.delegate = self
self.present(mreader, animated: true, completion: nil)
let epubPath = Bundle.main.path(forResource: "每天懂一点好玩心理学", ofType: "epub")
mreader.readWith(filePath: epubPath!, pageIndex: 1)
评论