I would like to have a big headline with a little text under it without pressing the back button.
Desired Result:

With a tip and a caption:
I set the time as a name, which is the opposite of what I want to put the name at the beginning

With custom navigationItem.titleView :


In the second photo, I add height to the navigationBar . This is very close to what I would like, but I want the back button to stay on top. I can simply change the limitations of my custom titleView if I can move the back button.
Current code:
func createTitleView() { let titleView = UIView() let titleLabel = UILabel() titleLabel.text = "Pete Diner" titleLabel.textColor = UIColor.whiteColor() titleLabel.font = UIFont.boldSystemFontOfSize(16.0) titleLabel.setTranslatesAutoresizingMaskIntoConstraints(false) let descLabel = UILabel() descLabel.text = "Open 9AM - 9PM" descLabel.textColor = UIColor.whiteColor() descLabel.font = UIFont.systemFontOfSize(14.0) descLabel.setTranslatesAutoresizingMaskIntoConstraints(false) titleView.addSubview(titleLabel) titleView.addSubview(descLabel) titleView.addConstraint(NSLayoutConstraint( item: titleView, attribute: .CenterX, relatedBy: .Equal, toItem: titleLabel, attribute: .CenterX, multiplier: 1.0, constant: 0)) titleView.addConstraint(NSLayoutConstraint( item: titleView, attribute: .CenterX, relatedBy: .Equal, toItem: descLabel, attribute: .CenterX, multiplier: 1.0, constant: 0)) titleView.addConstraint(NSLayoutConstraint( item: titleView, attribute: NSLayoutAttribute.CenterYWithinMargins, relatedBy: NSLayoutRelation.Equal, toItem: titleLabel, attribute: NSLayoutAttribute.CenterYWithinMargins, multiplier: 1.0, constant: 12)) titleView.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat( "V:[titleLabel]-2-[descLabel]", options: nil, metrics: nil, views: ["titleLabel": titleLabel, "descLabel": descLabel])) navigationItem.titleView = titleView let nav = navigationController?.navigationBar nav!.barTintColor = UIColor.customGreenColor() nav!.tintColor = UIColor.whiteColor() nav!.translucent = false nav!.frame.size.height = 60.0 }
Side panel:
Limitations are not set up to ~ 500 ms after the appearance of the view. I tried setting titleView to viewDidLayoutSubviews , which doesn't help. If anyone can help me, I will be grateful. I think this is the navigationBar / custom titleView problem.
source share