Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set navigation bar background image for all devices including iPhone X?

I am trying set background image for the navigation bar. It's working for all other devices, but in iPhone X its not working due to increased size.

like image 811
KavyaKavita Avatar asked Dec 13 '22 20:12

KavyaKavita


1 Answers

Use this code :

self.navigationBar.setBackgroundImage(UIImage(named: "navbar background").resizableImage(withCapInsets: UIEdgeInsets(top: 0, left: 0, bottom: 0 ,right: 0), resizingMode: .stretch), for: .default)
like image 178
Nij Avatar answered Feb 09 '23 00:02

Nij