             }
             view.backgroundColor = presentingViewController?.view.backgroundColor
             navigationController?.navigationBar.tintColor = presentingViewController?.view.tintColor
+            navigationItem.searchController?.searchBar.tintColor = presentingViewController?.view.tintColor
         }
     }
     
     override var prefersStatusBarHidden: Bool {
-        return navigationController?.isNavigationBarHidden == true || super.prefersStatusBarHidden
+        return navigationController?.isNavigationBarHidden == true && navigationItem.searchController?.isActive == false && navigationItem.searchController?.isBeingDismissed == false || super.prefersStatusBarHidden
     }
     
     override var preferredStatusBarUpdateAnimation: UIStatusBarAnimation {

            self.saveAndClose()
        }
    }
}

    }
    
    override func viewDidLoad() {
        navigationController?.hidesBarsOnTap = true
        
        let searchController = UISearchController(searchResultsController: nil)
        searchController.searchBar.delegate = self
        navigationItem.searchController = searchController
        navigationItem.hidesSearchBarWhenScrolling = false
        
        pdfView.autoScales = true
        pdfView.displaysPageBreaks = false
