Resolved UIButton image not rendering correctly on device

Discussion in 'iOS Programming' started by moonman239, Feb 6, 2017.

  1. moonman239, Feb 6, 2017
    Last edited: Feb 6, 2017

    moonman239 macrumors 68000

    Joined:
    Mar 27, 2009
    #1
    I just put in an image for a new button. This image is for both when the button is not selected and when it is. However, when I go to run my app on a device, I see a blue ellipse in the image's place. To make matters worse, I can't find any reference to an ellipse anywhere within my project.

    The image is a PNG file, and it renders correctly on my computer.

    Will someone please tell me how to fix this? Thanks.
     
  2. AxoNeuron macrumors 65816

    AxoNeuron

    Joined:
    Apr 22, 2012
    Location:
    The Left Coast
    #2
    It's difficult to say. Do you have a screenshot of what you're seeing?

    Also, how are you setting the image, programmatically or via storyboard?
     
  3. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #3
    That blue outline is the default appearance of a button of type Custom that has a title but no image. How are you configuring the button? (code or IB?)
     
  4. moonman239 thread starter macrumors 68000

    Joined:
    Mar 27, 2009
    #4
    1) Yes. Link: https://www.icloud.com/sharedalbum/#B0QGWZuqDNk2M8
    2) Storyboard
     
  5. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #5
    OK, that's not the default outline I was thinking of. So are there two buttons in the screenshots? The blue ellipse and the back button to its right? If so what's the difference between the two? If the button is completely configured in IB then show us a screenshot of the configuration screen for the button.
     
  6. moonman239, Feb 7, 2017
    Last edited: Feb 7, 2017

    moonman239 thread starter macrumors 68000

    Joined:
    Mar 27, 2009
    #6
    Yes, there are two buttons. The "back" button takes the user back to the previous screen, while the button in question tells an AVPlayer to repeat the last file it played.
    Edit: Here is a screenshot: https://drive.google.com/open?id=0BxWy5I3ibO--Yi1Nc2JYdVVfWFE

    Edit #2: I found a potential solution on Stack Overflow (link to question) One of the answers suggest checking the RGB profile - could this be the solution?

    Edit #3: Didn't work.
     
  7. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #7
    So what are those slashes in the button image name? UIButton loads its images with image(named: ) Is the button image in your xcassets? Also, I would not have spaces in the image file name.
     
  8. moonman239 thread starter macrumors 68000

    Joined:
    Mar 27, 2009
    #8
    UPDATE: Solved!! The solution was for me to go into Preview and set the color space of the image to sRGB.
     

Share This Page