Preview clean up
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import QuickLook
|
||||
|
||||
class FileList: UIViewController, UIViewControllerPreviewingDelegate {
|
||||
|
||||
@@ -198,10 +197,8 @@ extension FileList: UITableViewDataSource, UITableViewDelegate {
|
||||
didSelectFile(file)
|
||||
}
|
||||
else {
|
||||
let quickLook = QLPreviewController()
|
||||
previewManager.filePath = file.filePath
|
||||
quickLook.dataSource = previewManager
|
||||
self.navigationController?.pushViewController(quickLook, animated: true)
|
||||
let filePreview = previewManager.previewViewControllerForFile(file)
|
||||
self.navigationController?.pushViewController(filePreview, animated: true)
|
||||
}
|
||||
}
|
||||
tableView.deselectRowAtIndexPath(indexPath, animated: true)
|
||||
@@ -223,10 +220,7 @@ extension FileList: UITableViewDataSource, UITableViewDelegate {
|
||||
if file.isDirectory {
|
||||
return nil
|
||||
}
|
||||
let quickLook = QLPreviewController()
|
||||
previewManager.filePath = file.filePath
|
||||
quickLook.dataSource = previewManager
|
||||
return quickLook
|
||||
return previewManager.previewViewControllerForFile(file)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
||||
@@ -13,6 +13,13 @@ class PreviewManager: NSObject, QLPreviewControllerDataSource {
|
||||
|
||||
var filePath: NSURL?
|
||||
|
||||
func previewViewControllerForFile(file: File) -> UIViewController {
|
||||
let quickLook = QLPreviewController()
|
||||
quickLook.dataSource = self
|
||||
self.filePath = file.filePath
|
||||
return quickLook
|
||||
}
|
||||
|
||||
func numberOfPreviewItemsInPreviewController(controller: QLPreviewController) -> Int {
|
||||
return 1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user