Image on NSButtons not displaying @2x variants

Discussion in 'Mac Programming' started by silvercircle, Dec 23, 2012.

  1. macrumors member

    Nov 18, 2010
    I created images twice the size of that standard images to put on my buttons, and I named them "name@2x.png". I create my dialog with interface builder and set the image to use name.png.

    When I try this with a small test project, the high rez images are used when I move the dialog to a scaled HiDPI monitor.

    With my larger project, it simply won't work, the low res images are always used, but Images I on a toolbar in the same program do switch between high rez and low rez. So, it's not because I use the Display Manger or Carbon or Quickdraw because in that case the toolbar images would also not work.

    What could be the reason for this? I tried everything I could think of.
  2. macrumors G5


    Nov 25, 2005
    The image name must not include the ".png" suffix. "name.png" will load "name.png". Always. Plain "name" will load the most suitable image that starts with "name". for example "name@2x.png". Same if you use "imageNamed" in code.
  3. thread starter macrumors member

    Nov 18, 2010
    Thanks, this fixed it. I just selected the file name Interface Builder presented in the popup.
    You saved me a lot of time!

    Happy holidays.

Share This Page