How to set background image for UINavigationBar on different iOS Devices

前端 未结 4 1464
再見小時候
再見小時候 2021-01-24 19:37

I want to set full image on UINavigationBar, for this I have:

@2x image (640 x 128)
@3x image (960 x 192)

Below Screenshot is the

4条回答
  •  旧时难觅i
    2021-01-24 19:52

    try this code in viewDidLoad

    UINavigationBar.appearance().setBackgroundImage(UIImage(named: "image")!.resizableImage(withCapInsets: UIEdgeInsets.zero, resizingMode: .stretch), for: .default)

提交回复
热议问题