How to set image for bar button with swift?

前端 未结 14 1184
一个人的身影
一个人的身影 2020-11-28 04:22

I am trying to set an Image for bar button Item for that I have an image like:

\"enter

14条回答
  •  感情败类
    2020-11-28 05:09

    An easy solution may be the following

    barButtonItem.image = UIImage(named: "image")
    

    then go to your Assets.xcassets select the image and go to the Attribute Inspector and select "Original Image" in Reder as option.

提交回复
热议问题