Skip to content

Commit

Permalink
Ability to not load the thumbnails strip when the controller is created
Browse files Browse the repository at this point in the history
  • Loading branch information
StuFF mc committed Feb 14, 2017
1 parent 7cf9a70 commit 7bf8f64
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions PDFReader/Demo/StartViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ internal final class StartViewController: UIViewController {
/// Presents a document
///
/// - parameter document: document to present
///
/// Add `thumbnailsEnabled:false` to `createNew` to not load the thumbnails in the controller.
fileprivate func showDocument(_ document: PDFDocument) {
let image = UIImage(named: "")
let controller = PDFViewController.createNew(with: document, title: "", actionButtonImage: image, actionStyle: .activitySheet)
Expand Down
3 changes: 2 additions & 1 deletion Sources/Classes/PDFViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ extension PDFViewController {
/// - parameter backButton: button to override the default controller back button
///
/// - returns: a `PDFViewController`
public class func createNew(with document: PDFDocument, title: String? = nil, actionButtonImage: UIImage? = nil, actionStyle: ActionStyle = .print, backButton: UIBarButtonItem? = nil) -> PDFViewController {
public class func createNew(with document: PDFDocument, title: String? = nil, actionButtonImage: UIImage? = nil, actionStyle: ActionStyle = .print, backButton: UIBarButtonItem? = nil, thumbnailsEnabled: Bool? = true) -> PDFViewController {
let storyboard = UIStoryboard(name: "PDFReader", bundle: Bundle(for: PDFViewController.self))
let controller = storyboard.instantiateInitialViewController() as! PDFViewController
controller.document = document
Expand All @@ -30,6 +30,7 @@ extension PDFViewController {
}

controller.backButton = backButton
controller.thumbnailsEnabled = thumbnailsEnabled!

if let actionButtonImage = actionButtonImage {
controller.actionButton = UIBarButtonItem(image: actionButtonImage, style: .plain, target: controller, action: #selector(actionButtonPressed))
Expand Down

0 comments on commit 7bf8f64

Please # to comment.