1

So... I have added a button to my nav bar in the interface editor, however when I set the image I simply get a blue box. The images are the correct size, however they do not show up.enter image description here

here is a copy of one of the images (x1)

enter image description here

I'd like to know how to fix this is a non-programmatic way if possible.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Jobalisk
  • 728
  • 1
  • 6
  • 17
  • 1
    Check this out. There doesnt seem to be a way to do what you are trying in interace builder. http://stackoverflow.com/questions/27499998/how-to-set-image-for-bar-button-with-swift – TheAppMentor Oct 12 '16 at 02:27
  • In my case it is working. I am not sure but can you check by changing the tint color, may be the default tint color is blue and the icon color is same, so may be causing issue. Check and let me know – Janmenjaya Oct 12 '16 at 03:14
  • check your image size it is larger than button size – Anbu.Karthik Oct 12 '16 at 03:29
  • @TheAppMentor I know it is possible, because if you look at the image above, it quite clearly has a field for an image to be used instead of a title on the button.The images are 22X22, 44x44 and 66x66 as per apple specs – Jobalisk Oct 12 '16 at 18:01

1 Answers1

2

The problem is your image. The image isn't shown as-is. The image is used as a mask to generate the actual image. Only the alpha channel of the image is relevant, not any of the colors.

The simplest solution for your particular image is to remove all of the white from the image and make those parts fully transparent.

rmaddy
  • 314,917
  • 42
  • 532
  • 579