Created
July 23, 2018 11:17
-
-
Save onmyway133/429cc3a03aeb5efaa5d1fa3346d491a1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let navigationBar = UINavigationBar() | |
navigationBar.isTranslucent = false | |
navigationBar.delegate = self | |
navigationBar.backgroundColor = .white | |
navigationBar.items = [standaloneItem] | |
navigationBar.translatesAutoresizingMaskIntoConstraints = false | |
navigationBar.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true | |
navigationBar.rightAnchor.constraint(equalTo: view.rightAnchor).isActive = true | |
if #available(iOS 11, *) { | |
navigationBar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor).isActive = true | |
} else { | |
navigationBar.topAnchor.constraint(equalTo: view.topAnchor).isActive = true | |
} | |
extension BarcodeScannerController: UINavigationBarDelegate { | |
public func position(for bar: UIBarPositioning) -> UIBarPosition { | |
return .topAttached | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment