Skip to content

Commit

Permalink
Merge branch 'fix-issue-4'
Browse files Browse the repository at this point in the history
  • Loading branch information
weakfl committed Nov 17, 2017
2 parents 2de9bae + 7a910b6 commit c7fa70e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
17 changes: 12 additions & 5 deletions MediaBrowser/MediaBrowser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,7 @@ public class MediaBrowser: UIViewController, UIScrollViewDelegate, UIActionSheet
self.rotating = false
// Ensure nav bar isn't re-displayed
if let navi = self.navigationController, self.areControlsHidden {
navi.isNavigationBarHidden = false
navi.navigationBar.alpha = 0
navi.isNavigationBarHidden = true
}
}

Expand Down Expand Up @@ -716,6 +715,15 @@ public class MediaBrowser: UIViewController, UIScrollViewDelegate, UIActionSheet
if parent != nil && hasBelongedToViewController {
fatalError("MediaBrowser Instance Reuse")
}

if let navBar = navigationController?.navigationBar, didSavePreviousStateOfNavBar, parent == nil {
navBar.titleTextAttributes = [NSAttributedStringKey.foregroundColor:previousNavigationBarTextColor ?? UIColor.black]
navBar.backgroundColor = previousNavigationBarBackgroundColor
if previousNavigationBarTintColor != nil {
navBar.barTintColor = previousNavigationBarTintColor
}
navBar.tintColor = previousNavigationBarTextColor
}
}

/**
Expand Down Expand Up @@ -1751,14 +1759,13 @@ public class MediaBrowser: UIViewController, UIScrollViewDelegate, UIActionSheet
// Init grid controller
gridController = MediaGridViewController()

if let gc = gridController, let navBar = navigationController?.navigationBar {
if let gc = gridController {
let bounds = view.bounds
let naviHeight = navBar.frame.height + UIApplication.shared.statusBarFrame.height

gc.initialContentOffset = currentGridContentOffset
gc.browser = self
gc.selectionMode = displaySelectionButtons
gc.view.frame = CGRect(x: 0.0, y: naviHeight, width: bounds.width, height: bounds.height - naviHeight)
gc.view.frame = CGRect(x: 0, y: 0, width: bounds.width, height: bounds.height)
gc.view.alpha = 0.0

// Stop specific layout being triggered
Expand Down
3 changes: 2 additions & 1 deletion MediaBrowserDemo/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ class ViewController: UITableViewController {
super.viewWillAppear(animated)

navigationController?.navigationBar.tintColor = UIColor.black

navigationController?.navigationBar.barTintColor = .white
}

override func viewDidLoad() {
super.viewDidLoad()

Expand Down

0 comments on commit c7fa70e

Please sign in to comment.