Код: Выделить всё
class SampleViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let aTitleView = UIView()
aTitleView.backgroundColor = .gray
aTitleView.translatesAutoresizingMaskIntoConstraints = false
navigationItem.titleView = aTitleView
navigationItem.setHidesBackButton(true, animated: false)
navigationController?.edgesForExtendedLayout = .all
navigationController?.setNavigationBarHidden(false, animated: true)
navigationController?.navigationBar.shadowImage = UIImage()
navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
navigationController?.navigationBar.backIndicatorImage = UIImage()
navigationController?.navigationBar.backIndicatorTransitionMaskImage = UIImage()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
navigationController?.setNavigationBarHidden(false, animated: false)
}
}
Подробнее здесь: https://stackoverflow.com/questions/797 ... g-inside-u
Мобильная версия