Alua-Kinzhebayeva / iOS-PDF-Reader

PDF Reader for iOS written in Swift
MIT License
532 stars 150 forks source link

I tried to pass the startPageIndex as 10 but the pdf is not loaded as page 11 #92

Open kobenguyent opened 6 years ago

kobenguyent commented 6 years ago

I tried to pass the startPageIndex as 10 but the pdf is not loaded as page 11

private func showDocument(_ document: PDFDocument) {
        let image = UIImage(named: "")
        let controller = PDFViewController.createNew(with: document, title: document.fileName, actionButtonImage: image, actionStyle: .activitySheet, startPageIndex: 10)
        navigationController?.pushViewController(controller, animated: true)
    }

Could you please advise?

FCF5646448 commented 6 years ago

u should move the code " currentPageIndex = updatedPageIndex thumbnailCollectionController?.currentPageIndex = currentPageIndex" on the func scrollViewDidScroll to the other place, like this: public func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) { currentPageIndex = indexPath.row self.title = String(format: "%d/%d",currentPageIndex,self.document.pageCount) thumbnailCollectionController?.currentPageIndex = currentPageIndex }