Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arifinfrds/dd1d7d24bdbd3992bbb6def3b083a976 to your computer and use it in GitHub Desktop.
Save arifinfrds/dd1d7d24bdbd3992bbb6def3b083a976 to your computer and use it in GitHub Desktop.
Simple example of not clean ethod Implementation.
import UIKit
extension ViewController: UITableViewDelegate {
// Some UITableViewDelegate methods
// ...
func scrollViewDidScroll(_ scrollView: UIScrollView) {
let verticalOffset = tableView.contentOffset.y
if verticalOffset >= 64 {
navigationController?.unTransparentNavBar(tintColor: Resources.Color.primaryColor, barTintColor: .white)
let textAttributes = [NSAttributedStringKey.foregroundColor: UIColor.black]
navigationController?.navigationBar.titleTextAttributes = textAttributes
} else {
navigationController?.transparentNavBar(tintColor: .white)
let textAttributes = [NSAttributedStringKey.foregroundColor: UIColor.clear]
navigationController?.navigationBar.titleTextAttributes = textAttributes
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment