From 29b4e75a975f241e6909cf48124f2a221b337068 Mon Sep 17 00:00:00 2001 From: Kyon Li Date: Wed, 6 Jul 2016 16:02:39 +0800 Subject: [PATCH 1/6] Update FolioReaderCenter.swift --- Source/FolioReaderCenter.swift | 53 ++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 19 deletions(-) diff --git a/Source/FolioReaderCenter.swift b/Source/FolioReaderCenter.swift index 27ef9ec6a..6285e941d 100755 --- a/Source/FolioReaderCenter.swift +++ b/Source/FolioReaderCenter.swift @@ -93,7 +93,7 @@ class ScrollScrubber: NSObject, UIScrollViewDelegate { } func sliderChange(slider:UISlider) { - let offset = CGPointMake(0, height()*CGFloat(slider.value)) + let offset = CGPointMake(height()*CGFloat(slider.value), 0) scrollView().setContentOffset(offset, animated: false) } @@ -157,7 +157,7 @@ class ScrollScrubber: NSObject, UIScrollViewDelegate { } if scrollStart == nil { - scrollStart = scrollView.contentOffset.y + scrollStart = scrollView.contentOffset.x } } @@ -172,7 +172,7 @@ class ScrollScrubber: NSObject, UIScrollViewDelegate { show() } else if delegate.currentPage != nil && scrollStart != nil { - scrollDelta = scrollView.contentOffset.y - scrollStart + scrollDelta = scrollView.contentOffset.x - scrollStart if scrollDeltaTimer == nil && scrollDelta > (pageHeight * 0.2 ) || (scrollDelta * -1) > (pageHeight * 0.2) { show() @@ -197,7 +197,7 @@ class ScrollScrubber: NSObject, UIScrollViewDelegate { scrollDeltaTimer = nil } - scrollStart = scrollView().contentOffset.y + scrollStart = scrollView().contentOffset.x scrollDelta = 0 } @@ -217,7 +217,7 @@ class ScrollScrubber: NSObject, UIScrollViewDelegate { } private func scrollTop() -> CGFloat { - return delegate.currentPage.webView.scrollView.contentOffset.y + return delegate.currentPage.webView.scrollView.contentOffset.x } } @@ -256,7 +256,7 @@ class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UICollectio layout.sectionInset = UIEdgeInsetsZero layout.minimumLineSpacing = 0 layout.minimumInteritemSpacing = 0 - layout.scrollDirection = UICollectionViewScrollDirection.Vertical + layout.scrollDirection = UICollectionViewScrollDirection.Horizontal let background = isNight(readerConfig.nightModeBackground, UIColor.whiteColor()) view.backgroundColor = background @@ -268,6 +268,7 @@ class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UICollectio collectionView.dataSource = self collectionView.pagingEnabled = true collectionView.showsVerticalScrollIndicator = false + collectionView.showsHorizontalScrollIndicator = false collectionView.backgroundColor = background collectionView.decelerationRate = UIScrollViewDecelerationRateFast view.addSubview(collectionView) @@ -291,7 +292,7 @@ class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UICollectio let scrubberY: CGFloat = readerConfig.shouldHideNavigationOnTap == true ? 50 : 74 scrollScrubber = ScrollScrubber(frame: CGRect(x: pageWidth + 10, y: scrubberY, width: 40, height: pageHeight - 100)) scrollScrubber.delegate = self - view.addSubview(scrollScrubber.slider) +// view.addSubview(scrollScrubber.slider) // Loading indicator let style: UIActivityIndicatorViewStyle = isNight(.White, .Gray) @@ -320,6 +321,11 @@ class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UICollectio let navText = isNight(UIColor.whiteColor(), UIColor.blackColor()) let font = UIFont(name: "Avenir-Light", size: 17)! setTranslucentNavigation(color: navBackground, tintColor: tintColor, titleColor: navText, andFont: font) + if FolioReader.sharedInstance.nightMode { + UIApplication.sharedApplication().setStatusBarStyle(UIStatusBarStyle.LightContent, animated: true) + } else { + UIApplication.sharedApplication().setStatusBarStyle(UIStatusBarStyle.Default, animated: true) + } } func configureNavBarButtons() { @@ -575,18 +581,18 @@ class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UICollectio if orientation.isPortrait { if screenBounds.size.width < screenBounds.size.height { pageWidth = screenBounds.size.width - pageHeight = screenBounds.size.height + pageHeight = screenBounds.size.height - 20 - pageIndicatorHeight } else { pageWidth = screenBounds.size.height - pageHeight = screenBounds.size.width + pageHeight = screenBounds.size.width - 20 - pageIndicatorHeight } } else { if screenBounds.size.width > screenBounds.size.height { pageWidth = screenBounds.size.width - pageHeight = screenBounds.size.height + pageHeight = screenBounds.size.height - 20 - pageIndicatorHeight } else { pageWidth = screenBounds.size.height - pageHeight = screenBounds.size.width + pageHeight = screenBounds.size.width - 20 - pageIndicatorHeight } } } @@ -627,8 +633,11 @@ class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UICollectio if let readingTime = page.webView.js("getReadingTime()") { pageIndicatorView.totalMinutes = Int(readingTime)! - pagesForCurrentPage(page) + + } else { + pageIndicatorView.totalMinutes = 0 } + pagesForCurrentPage(page) } if (completion != nil) { completion!() } @@ -636,8 +645,8 @@ class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UICollectio func pagesForCurrentPage(page: FolioReaderPage?) { if let page = page { - pageIndicatorView.totalPages = Int(ceil(page.webView.scrollView.contentSize.height/pageHeight)) - let webViewPage = pageForOffset(currentPage.webView.scrollView.contentOffset.y, pageHeight: pageHeight) + pageIndicatorView.totalPages = Int(ceil(page.webView.scrollView.contentSize.width/pageWidth)) + let webViewPage = pageForOffset(currentPage.webView.scrollView.contentOffset.x, pageHeight: pageWidth) pageIndicatorView.currentPage = webViewPage } } @@ -677,7 +686,7 @@ class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UICollectio } func frameForPage(page: Int) -> CGRect { - return CGRectMake(0, pageHeight * CGFloat(page-1), pageWidth, pageHeight) + return CGRectMake(pageWidth * CGFloat(page-1), 0, pageWidth, pageHeight) } func changePageWith(page page: Int, animated: Bool = false, completion: (() -> Void)? = nil) { @@ -746,7 +755,7 @@ class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UICollectio } UIView.animateWithDuration(animated ? 0.3 : 0, delay: 0, options: .CurveEaseInOut, animations: { () -> Void in - self.collectionView.scrollToItemAtIndexPath(indexPath, atScrollPosition: .Top, animated: false) + self.collectionView.scrollToItemAtIndexPath(indexPath, atScrollPosition: .Left, animated: false) }) { (finished: Bool) -> Void in if (completion != nil) { completion!() } } @@ -1014,6 +1023,12 @@ class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UICollectio } scrollScrubber.scrollViewWillBeginDragging(scrollView) + +// let currentPageNum = Int(pointNow.x / scrollView.bounds.size.width) + 1 +// if currentPage.webView.pageCount - 1 == currentPageNum { +// currentPage.refreshPageMode() +// } + currentPage.refreshPageMode() } func scrollViewDidScroll(scrollView: UIScrollView) { @@ -1026,15 +1041,15 @@ class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UICollectio // Update current reading page if scrollView is UICollectionView {} else { - if let page = currentPage where page.webView.scrollView.contentOffset.y+pageHeight <= page.webView.scrollView.contentSize.height { - let webViewPage = pageForOffset(page.webView.scrollView.contentOffset.y, pageHeight: pageHeight) + if let page = currentPage where page.webView.scrollView.contentOffset.x+pageWidth <= page.webView.scrollView.contentSize.width { + let webViewPage = pageForOffset(page.webView.scrollView.contentOffset.x, pageHeight: pageWidth) if pageIndicatorView.currentPage != webViewPage { pageIndicatorView.currentPage = webViewPage } } } - scrollDirection = scrollView.contentOffset.y < pointNow.y ? .Down : .Up + scrollDirection = scrollView.contentOffset.x < pointNow.x ? .Right : .Left } func scrollViewDidEndDecelerating(scrollView: UIScrollView) { From b8910c346627c53dd5ff43eece81c0c8a3036144 Mon Sep 17 00:00:00 2001 From: Kyon Li Date: Wed, 6 Jul 2016 16:03:59 +0800 Subject: [PATCH 2/6] Update FolioReaderContainer.swift --- Source/FolioReaderContainer.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/FolioReaderContainer.swift b/Source/FolioReaderContainer.swift index 9ea4ff4bc..91e6ff0ec 100755 --- a/Source/FolioReaderContainer.swift +++ b/Source/FolioReaderContainer.swift @@ -99,9 +99,9 @@ class FolioReaderContainer: UIViewController, FolioReaderSidePanelDelegate { // Add gestures let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(FolioReaderContainer.handleTapGesture(_:))) tapGestureRecognizer.numberOfTapsRequired = 1 - let panGestureRecognizer = UIPanGestureRecognizer(target: self, action: #selector(FolioReaderContainer.handlePanGesture(_:))) +// let panGestureRecognizer = UIPanGestureRecognizer(target: self, action: #selector(FolioReaderContainer.handlePanGesture(_:))) centerNavigationController.view.addGestureRecognizer(tapGestureRecognizer) - centerNavigationController.view.addGestureRecognizer(panGestureRecognizer) +// centerNavigationController.view.addGestureRecognizer(panGestureRecognizer) // Read async book if (epubPath != nil) { From 1429687f118721e967fc5eaa7db93586e52c9bb3 Mon Sep 17 00:00:00 2001 From: Kyon Li Date: Wed, 6 Jul 2016 16:05:13 +0800 Subject: [PATCH 3/6] Update FolioReaderKit.swift --- Source/FolioReaderKit.swift | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/Source/FolioReaderKit.swift b/Source/FolioReaderKit.swift index 792047053..d08bb2602 100755 --- a/Source/FolioReaderKit.swift +++ b/Source/FolioReaderKit.swift @@ -70,14 +70,12 @@ public class FolioReader : NSObject { get { return FolioReader.defaults.boolForKey(kNightMode) } set (value) { FolioReader.defaults.setBool(value, forKey: kNightMode) - FolioReader.defaults.synchronize() } } var currentFontName: Int { get { return FolioReader.defaults.valueForKey(kCurrentFontFamily) as! Int } set (value) { FolioReader.defaults.setValue(value, forKey: kCurrentFontFamily) - FolioReader.defaults.synchronize() } } @@ -85,7 +83,6 @@ public class FolioReader : NSObject { get { return FolioReader.defaults.valueForKey(kCurrentFontSize) as! Int } set (value) { FolioReader.defaults.setValue(value, forKey: kCurrentFontSize) - FolioReader.defaults.synchronize() } } @@ -93,7 +90,6 @@ public class FolioReader : NSObject { get { return FolioReader.defaults.valueForKey(kCurrentAudioRate) as! Int } set (value) { FolioReader.defaults.setValue(value, forKey: kCurrentAudioRate) - FolioReader.defaults.synchronize() } } @@ -101,7 +97,6 @@ public class FolioReader : NSObject { get { return FolioReader.defaults.valueForKey(kCurrentHighlightStyle) as! Int } set (value) { FolioReader.defaults.setValue(value, forKey: kCurrentHighlightStyle) - FolioReader.defaults.synchronize() } } @@ -109,7 +104,6 @@ public class FolioReader : NSObject { get { return MediaOverlayStyle(rawValue: FolioReader.defaults.valueForKey(kCurrentMediaOverlayStyle) as! Int)! } set (value) { FolioReader.defaults.setValue(value.rawValue, forKey: kCurrentMediaOverlayStyle) - FolioReader.defaults.synchronize() } } @@ -158,11 +152,10 @@ public class FolioReader : NSObject { if let currentPage = FolioReader.sharedInstance.readerCenter.currentPage { let position = [ "pageNumber": currentPageNumber, - "pageOffset": currentPage.webView.scrollView.contentOffset.y + "pageOffset": currentPage.webView.scrollView.contentOffset.x ] FolioReader.defaults.setObject(position, forKey: kBookId) - FolioReader.defaults.synchronize() } } } From 31f61b7dda559e6b3109ff29199ac42a54e0663a Mon Sep 17 00:00:00 2001 From: Kyon Li Date: Wed, 6 Jul 2016 16:05:58 +0800 Subject: [PATCH 4/6] Update FolioReaderPage.swift --- Source/FolioReaderPage.swift | 112 ++++++++++++++++++++++++++++++----- 1 file changed, 98 insertions(+), 14 deletions(-) diff --git a/Source/FolioReaderPage.swift b/Source/FolioReaderPage.swift index 36d06e2f6..d81f18b20 100755 --- a/Source/FolioReaderPage.swift +++ b/Source/FolioReaderPage.swift @@ -15,10 +15,11 @@ import JSQWebViewController optional func pageDidLoad(page: FolioReaderPage) } -class FolioReaderPage: UICollectionViewCell, UIWebViewDelegate, UIGestureRecognizerDelegate, FolioReaderAudioPlayerDelegate { +class FolioReaderPage: UICollectionViewCell, UIWebViewDelegate, UIScrollViewDelegate, UIGestureRecognizerDelegate, FolioReaderAudioPlayerDelegate { var pageNumber: Int! var webView: UIWebView! + private var colorView: UIView! weak var delegate: FolioPageDelegate! private var shouldShowBar = true private var menuIsVisible = false @@ -29,26 +30,53 @@ class FolioReaderPage: UICollectionViewCell, UIWebViewDelegate, UIGestureRecogni super.init(frame: frame) self.backgroundColor = UIColor.whiteColor() + NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(self.refreshPageMode), name: "needRefreshPageMode", object: nil) + if webView == nil { webView = UIWebView(frame: webViewFrame()) webView.autoresizingMask = [.FlexibleWidth, .FlexibleHeight] webView.dataDetectorTypes = [.None, .Link] webView.scrollView.showsVerticalScrollIndicator = false + webView.scrollView.showsHorizontalScrollIndicator = false + webView.scrollView.pagingEnabled = true + webView.scrollView.bounces = false webView.backgroundColor = UIColor.clearColor() + webView.paginationMode = UIWebPaginationMode.LeftToRight + webView.paginationBreakingMode = UIWebPaginationBreakingMode.Page self.contentView.addSubview(webView) } webView.delegate = self + if colorView == nil { + colorView = UIView(); + colorView.backgroundColor = UIColor(rgba: "#131313") + webView.scrollView.addSubview(colorView); + } + let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(FolioReaderPage.handleTapGesture(_:))) tapGestureRecognizer.numberOfTapsRequired = 1 tapGestureRecognizer.delegate = self webView.addGestureRecognizer(tapGestureRecognizer) + +// var swipeLeftGestureRecognizer = UISwipeGestureRecognizer(target: self, action: #selector(FolioReaderPage.handleSwipeGesture(_:))) +// swipeLeftGestureRecognizer.direction = UISwipeGestureRecognizerDirection.Left +// swipeLeftGestureRecognizer.delegate = self +// webView.addGestureRecognizer(swipeLeftGestureRecognizer) +// +// var swipeRightGestureRecognizer = UISwipeGestureRecognizer(target: self, action: #selector(FolioReaderPage.handleSwipeGesture(_:))) +// swipeRightGestureRecognizer.direction = UISwipeGestureRecognizerDirection.Right +// swipeRightGestureRecognizer.delegate = self +// webView.addGestureRecognizer(swipeRightGestureRecognizer) } required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) } + deinit { + NSNotificationCenter.defaultCenter().removeObserver(self) + } + override func layoutSubviews() { super.layoutSubviews() @@ -103,6 +131,8 @@ class FolioReaderPage: UICollectionViewCell, UIWebViewDelegate, UIGestureRecogni // MARK: - UIWebView Delegate func webViewDidFinishLoad(webView: UIWebView) { + self.refreshPageMode() + if (!book.hasAudio()) { FolioReader.sharedInstance.readerAudioPlayer.delegate = self; self.webView.js("wrappingSentencesWithinPTags()"); @@ -111,11 +141,11 @@ class FolioReaderPage: UICollectionViewCell, UIWebViewDelegate, UIGestureRecogni } } - webView.scrollView.contentSize = CGSizeMake(pageWidth, webView.scrollView.contentSize.height) +// webView.scrollView.contentSize = CGSizeMake(pageWidth, webView.scrollView.contentSize.height) - if scrollDirection == .Down && isScrolling { - let bottomOffset = CGPointMake(0, webView.scrollView.contentSize.height - webView.scrollView.bounds.height) - if bottomOffset.y >= 0 { + if scrollDirection == .Right && isScrolling { + let bottomOffset = CGPointMake(webView.scrollView.contentSize.width - webView.scrollView.bounds.width, 0) + if bottomOffset.x >= 0 { dispatch_async(dispatch_get_main_queue(), { webView.scrollView.setContentOffset(bottomOffset, animated: false) }) @@ -261,10 +291,50 @@ class FolioReaderPage: UICollectionViewCell, UIWebViewDelegate, UIGestureRecogni menuIsVisible = false } + func handleSwipeGesture(recognizer: UISwipeGestureRecognizer) { + let width = self.webView.bounds.size.width + var currentPageNum: Int = Int(self.webView.scrollView.contentOffset.x / width) + var totalPageNum: Int = Int(self.webView.scrollView.contentSize.width / width) + if self.webView.scrollView.contentSize.width % width != 0 { + totalPageNum += 1 + } + + switch recognizer.direction { + case UISwipeGestureRecognizerDirection.Left: + if currentPageNum < totalPageNum - 1 { +// self.webView.scrollView.contentOffset = CGPointMake(CGFloat(currentPageNum + 1) * width, 0) +// self.transition("pageCurl", subtype: kCATransitionFromRight, view: self.webView) + } else { + FolioReader.sharedInstance.readerCenter.changePageToNext() + } + case UISwipeGestureRecognizerDirection.Right: + if currentPageNum > 0 { +// self.webView.scrollView.contentOffset = CGPointMake(CGFloat(currentPageNum - 1) * width, 0) +// self.transition("pageCurl", subtype: kCATransitionFromLeft, view: self.webView) + } else { + if self.webView.scrollView.contentOffset.x == 0 { + FolioReader.sharedInstance.readerCenter.changePageToPrevious() + } + } + default: + break + } + + } + + func transition(type: String, subtype: String, view: UIView) { + let animation = CATransition(); + animation.duration = 0.7 + animation.type = type + animation.subtype = subtype + animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) + view.layer.addAnimation(animation, forKey: "animation") + } + // MARK: - Scroll positioning func scrollPageToOffset(offset: String, animating: Bool) { - let jsCommand = "window.scrollTo(0,\(offset));" + let jsCommand = "window.scrollTo(\(offset),0);" if animating { UIView.animateWithDuration(0.35, animations: { self.webView.js(jsCommand) @@ -348,6 +418,19 @@ class FolioReaderPage: UICollectionViewCell, UIWebViewDelegate, UIGestureRecogni func audioMarkID(ID: String){ self.webView.js("audioMarkID('\(book.playbackActiveClass())','\(ID)')"); } + + func refreshPageMode() { + if FolioReader.sharedInstance.nightMode { + // omit create webView and colorView + let script = "document.documentElement.offsetHeight" + let contentHeight = webView.stringByEvaluatingJavaScriptFromString(script) + let frameHeight = webView.frame.height + let lastPageHeight = frameHeight * CGFloat(webView.pageCount) - CGFloat(Double(contentHeight!)!) + colorView.frame = CGRectMake(webView.frame.width * CGFloat(webView.pageCount-1), webView.frame.height - lastPageHeight, webView.frame.width, lastPageHeight) + } else { + colorView.frame = CGRectZero + } + } } // MARK: - WebView Highlight and share implementation @@ -375,30 +458,30 @@ extension UIWebView { // menu on existing highlight if isShare { - if action == #selector(UIWebView.colors(_:)) || (action == #selector(UIWebView.share(_:)) && readerConfig?.allowSharing == true) || action == #selector(UIWebView.remove(_:)) { + if action == #selector(UIWebView.colors(_:)) || (action == #selector(UIWebView.share(_:)) && readerConfig.allowSharing == true) || action == #selector(UIWebView.remove(_:)) { return true } return false - // menu for selecting highlight color + // menu for selecting highlight color } else if isColors { if action == #selector(UIWebView.setYellow(_:)) || action == #selector(UIWebView.setGreen(_:)) || action == #selector(UIWebView.setBlue(_:)) || action == #selector(UIWebView.setPink(_:)) || action == #selector(UIWebView.setUnderline(_:)) { return true } return false - // default menu + // default menu } else { var isOneWord = false if let result = js("getSelectedText()") where result.componentsSeparatedByString(" ").count == 1 { isOneWord = true } - + if action == #selector(UIWebView.highlight(_:)) - || (action == #selector(UIWebView.define(_:)) && isOneWord) - || (action == #selector(UIWebView.play(_:)) && (book.hasAudio() || readerConfig?.enableTTS == true)) - || (action == #selector(UIWebView.share(_:)) && readerConfig?.allowSharing == true) - || (action == #selector(NSObject.copy(_:)) && readerConfig?.allowSharing == true) { + || (action == #selector(UIWebView.define(_:)) && isOneWord) + || (action == #selector(UIWebView.play(_:)) && (book.hasAudio() || readerConfig.enableTTS)) + || (action == #selector(UIWebView.share(_:)) && readerConfig.allowSharing == true) + || (action == #selector(NSObject.copy(_:)) && readerConfig.allowSharing == true) { return true } return false @@ -565,6 +648,7 @@ extension UIWebView { func js(script: String) -> String? { let callback = self.stringByEvaluatingJavaScriptFromString(script) + NSNotificationCenter.defaultCenter().postNotificationName("needRefreshPageMode", object: nil) if callback!.isEmpty { return nil } return callback } From 08fd8a588afa4de4aa5b8c8b1e535d6917d39153 Mon Sep 17 00:00:00 2001 From: Kyon Li Date: Wed, 6 Jul 2016 16:06:58 +0800 Subject: [PATCH 5/6] Update FolioReaderSidePanel.swift --- Source/FolioReaderSidePanel.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/FolioReaderSidePanel.swift b/Source/FolioReaderSidePanel.swift index 1a5fe4097..241851e07 100755 --- a/Source/FolioReaderSidePanel.swift +++ b/Source/FolioReaderSidePanel.swift @@ -191,6 +191,7 @@ class FolioReaderSidePanel: UIViewController, UITableViewDelegate, UITableViewDa func didSelectClose(sender: UIBarButtonItem) { self.dismissViewControllerAnimated(true, completion: { + FolioReader.saveReaderState() FolioReader.sharedInstance.isReaderOpen = false FolioReader.sharedInstance.isReaderReady = false FolioReader.sharedInstance.readerAudioPlayer.stop() From 07008abcdee7e1ae012f5e01ffdae855abeb3e73 Mon Sep 17 00:00:00 2001 From: Kyon Li Date: Wed, 6 Jul 2016 16:11:59 +0800 Subject: [PATCH 6/6] Update FolioReaderPage.swift --- Source/FolioReaderPage.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/FolioReaderPage.swift b/Source/FolioReaderPage.swift index d81f18b20..c099845a0 100755 --- a/Source/FolioReaderPage.swift +++ b/Source/FolioReaderPage.swift @@ -15,7 +15,7 @@ import JSQWebViewController optional func pageDidLoad(page: FolioReaderPage) } -class FolioReaderPage: UICollectionViewCell, UIWebViewDelegate, UIScrollViewDelegate, UIGestureRecognizerDelegate, FolioReaderAudioPlayerDelegate { +class FolioReaderPage: UICollectionViewCell, UIWebViewDelegate, UIGestureRecognizerDelegate, FolioReaderAudioPlayerDelegate { var pageNumber: Int! var webView: UIWebView!