How to put an image in the center of navigationBar of a UIViewController?

后端 未结 7 2157
耶瑟儿~
耶瑟儿~ 2021-02-01 05:31

I have this snippet of code used in viewDidLoad of a UIViewController. I\'va no errors. Images exists. I get the background but not the image. Image is a sort of logo.



        
7条回答
  •  野的像风
    2021-02-01 06:10

    Swift:

    var logoImage:UIImage = UIImage(named: "logo_text")!
    self.navigationItem.titleView = UIImageView(image: logoImage)
    

提交回复
热议问题