I had a problem in one of my apps, that the background image I set, was too small for the new iPhone X.
So I tried a few things, but nothing worked. For example you could add a taller @3x background image, but then it would be clipped on an iPhone 8 Plus for example.
Finally I found a working solution for swift 3.2. (It should also work in swift 4)
Code:
1 | nvc.navigationBar.setBackgroundImage(UIImage(named: "navbar background").resizableImage(withCapInsets: UIEdgeInsets(top: 0, left: 0, bottom: 0 ,right: 0), resizingMode: .stretch), for: .default) |
On the left side is a iPhone 8 Plus simulator and on the right side is the iPhone X simulator.