I have one UIViewController in my Swift 3.3 UIViewController , in which I need to set a non-standard header. Before iOS11, I did it this way (I’m not presenting all the code, but only the key points):
class MyController : UIViewController { private lazy var customTitleView : UIImageView = { $0.frame = CGRect(x:0, y:0, width:10, height:10) $0.contentMode = .scaleAspectFit $0.clipsToBounds = true return $0 }(UIImageView(image:UIImage(named:"my_image"))) override func viewDidLoad() { super.viewDidLoad() self.navigationItem.titleView = self.customTitleView } } Previously, thanks to this code, the self.navigationItem header was always centered, and the image kept the size I specified in the initializer. Now in iOS11, this header is stretched across the entire height, the dimensions I specified are ignored. How can I get back the old behavior of the program?