Skip to content

Commit

Permalink
Update demo app
Browse files Browse the repository at this point in the history
  • Loading branch information
andreamazz committed Sep 15, 2021
1 parent 9feed34 commit 5016bc1
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 12 deletions.
17 changes: 12 additions & 5 deletions Demo/ScrollingNavbarDemo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,17 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?

func applicationDidFinishLaunching(_ application: UIApplication) {
UINavigationBar.appearance().tintColor = .white
UINavigationBar.appearance().titleTextAttributes = [NSAttributedStringKey.foregroundColor: UIColor.white]
UINavigationBar.appearance().largeTitleTextAttributes = [NSAttributedStringKey.foregroundColor: UIColor.white]
// UINavigationBar.appearance().isTranslucent = false
if #available(iOS 13.0, *) {
let appearance = UINavigationBarAppearance()
appearance.buttonAppearance.normal.titleTextAttributes = [NSAttributedStringKey.foregroundColor: UIColor.white]
appearance.titleTextAttributes = [NSAttributedStringKey.foregroundColor: UIColor.white]
appearance.largeTitleTextAttributes = [NSAttributedStringKey.foregroundColor: UIColor.white]
UINavigationBar.appearance().standardAppearance = appearance
UINavigationBar.appearance().scrollEdgeAppearance = UINavigationBar.appearance().standardAppearance
} else {
UINavigationBar.appearance().tintColor = .white
UINavigationBar.appearance().titleTextAttributes = [NSAttributedStringKey.foregroundColor: UIColor.white]
UINavigationBar.appearance().largeTitleTextAttributes = [NSAttributedStringKey.foregroundColor: UIColor.white]
}
}

}
7 changes: 6 additions & 1 deletion Demo/ScrollingNavbarDemo/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ class ViewController: UITableViewController {
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)

navigationController?.navigationBar.barTintColor = UIColor(red:0.1, green:0.1, blue:0.1, alpha:1)
if #available(iOS 13.0, *) {
navigationController?.navigationBar.standardAppearance.backgroundColor = UIColor(red:0.1, green:0.1, blue:0.1, alpha:1)
navigationController?.navigationBar.scrollEdgeAppearance = navigationController?.navigationBar.standardAppearance
} else {
navigationController?.navigationBar.barTintColor = UIColor(red:0.1, green:0.1, blue:0.1, alpha:1)
}
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ class CollectionViewController: UIViewController, UICollectionViewDataSource, UI

title = "CollectionView"
navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .add, target: nil, action: nil)
navigationController?.navigationBar.barTintColor = UIColor(red:0.91, green:0.3, blue:0.24, alpha:1)
if #available(iOS 13.0, *) {
navigationController?.navigationBar.standardAppearance.backgroundColor = UIColor(red:0.91, green:0.3, blue:0.24, alpha:1)
navigationController?.navigationBar.scrollEdgeAppearance = navigationController?.navigationBar.standardAppearance
} else {
navigationController?.navigationBar.barTintColor = UIColor(red:0.91, green:0.3, blue:0.24, alpha:1)
}
let flowLayout = UICollectionViewFlowLayout()
flowLayout.minimumInteritemSpacing = 1;
flowLayout.minimumLineSpacing = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ class LargeTitleViewController: ScrollingNavigationViewController, ScrollingNavi
super.viewDidLoad()

title = "ScrollView"

navigationController?.navigationBar.barTintColor = UIColor(red:0.17, green:0.59, blue:0.87, alpha:1)

if #available(iOS 13.0, *) {
navigationController?.navigationBar.standardAppearance.backgroundColor = UIColor(red:0.17, green:0.59, blue:0.87, alpha:1)
navigationController?.navigationBar.scrollEdgeAppearance = navigationController?.navigationBar.standardAppearance
} else {
navigationController?.navigationBar.barTintColor = UIColor(red:0.17, green:0.59, blue:0.87, alpha:1)
}
tabBarController?.tabBar.barTintColor = UIColor(red:0.17, green:0.59, blue:0.87, alpha:1)
tabBarController?.tabBar.tintColor = .white

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ class ScrollViewController: ScrollingNavigationViewController, ScrollingNavigati

// navigationItem.prompt = "Prompt"

navigationController?.navigationBar.barTintColor = UIColor(red:0.17, green:0.59, blue:0.87, alpha:1)
if #available(iOS 13.0, *) {
navigationController?.navigationBar.standardAppearance.backgroundColor = UIColor(red:0.17, green:0.59, blue:0.87, alpha:1)
navigationController?.navigationBar.scrollEdgeAppearance = navigationController?.navigationBar.standardAppearance
} else {
navigationController?.navigationBar.barTintColor = UIColor(red:0.17, green:0.59, blue:0.87, alpha:1)
}

tabBarController?.tabBar.barTintColor = UIColor(red:0.17, green:0.59, blue:0.87, alpha:1)
tabBarController?.tabBar.tintColor = .white

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,14 @@ class TableViewController: ScrollingNavigationViewController, UITableViewDelegat
toolbar.barTintColor = UIColor(red:0.91, green:0.3, blue:0.24, alpha:1)
toolbar.tintColor = .white
navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .add, target: nil, action: nil)
navigationController?.navigationBar.barTintColor = UIColor(red:0.91, green:0.3, blue:0.24, alpha:1)
navigationItem.searchController = UISearchController(searchResultsController: nil)

if #available(iOS 13.0, *) {
navigationController?.navigationBar.standardAppearance.backgroundColor = UIColor(red:0.91, green:0.3, blue:0.24, alpha:1)
navigationController?.navigationBar.scrollEdgeAppearance = navigationController?.navigationBar.standardAppearance
} else {
navigationController?.navigationBar.barTintColor = UIColor(red:0.91, green:0.3, blue:0.24, alpha:1)
}
}

// Enable the navbar scrolling
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ class WebViewController: ScrollingNavigationViewController, UIWebViewDelegate {

view.backgroundColor = UIColor(red:0.17, green:0.24, blue:0.32, alpha:1)
webView.backgroundColor = UIColor(red:0.17, green:0.24, blue:0.32, alpha:1)
navigationController?.navigationBar.barTintColor = UIColor(red:0.2, green:0.28, blue:0.37, alpha:1)

if #available(iOS 13.0, *) {
navigationController?.navigationBar.standardAppearance.backgroundColor = UIColor(red:0.2, green:0.28, blue:0.37, alpha:1)
navigationController?.navigationBar.scrollEdgeAppearance = navigationController?.navigationBar.standardAppearance
} else {
navigationController?.navigationBar.barTintColor = UIColor(red:0.2, green:0.28, blue:0.37, alpha:1)
}

// Load some content
webView.load(URLRequest(url: URL(string: "https://www.fancypixel.it")!))
Expand Down

0 comments on commit 5016bc1

Please sign in to comment.