Resolved UIImageView problem when deployed to iPhone

Discussion in 'iOS Programming' started by MickeyT, Jan 4, 2013.

  1. MickeyT, Jan 4, 2013
    Last edited: Jan 6, 2013

    MickeyT macrumors member

    Joined:
    Apr 26, 2010
    Location:
    Newcastle, United Kingdom
    #1
    I deployed an app to my phone for the first time last night. I picked a relatively simple app that I made a long time ago from a book. It was therefore done before the iPhone 5 and the larger screen (which I thought I'd mention in case it is relevant).

    I deployed it and it ran absolutely fine. However, it had no app icon. I decided to use the first image in a batch of 20 images that are used in the app as the app icon just so I could see what it looked like on my phone. For reference, when the app launches, it looks the image in thumbnail 1.

    I opened the image from a Finder window and changed its size in Preview to 114 x 114 pixels. I saved this via the Duplicate option as a new image and then added the new image to my project and assigned it to the Retina display app icon slot.

    However, I forgot to then undo the changes I had made to the original image before deploying the app to my phone. On launching on my phone, the app looked like thumbnail 2.

    I undid the changes, resaved the image, and even deleted the image from the project and re-added it. This image and the other 19 are all listed as being 320 x 320 in the inspector, and the app shows up as normal in the simulator. However, I cannot get the app to show the rabbit at the correct size on my phone. I have deleted the app from my phone and redeployed it after checking that the affected image is definitely the same resolution as the others, but it still shows up bigger. All subsequent frames of the rabbit show up on my phone absolutely fine (thumbnail 3).

    For information, this was a simple exercise in a book where 20 images are added to a UIImageView and animated so that the rabbit jumps up and down and does a somersault.

    Does anyone have any idea why the image shows up the way it does, even when it runs fine in the simulator?

    Please let me know if you need more information.

    Thank you.
     

    Attached Files:

  2. KoolStar macrumors demi-god

    KoolStar

    Joined:
    Oct 16, 2006
    Location:
    Kentucky
    #2
    Try cleaning the project before deploying to the device. Sometimes assets are not updated on a normal compilation.
     
  3. MickeyT thread starter macrumors member

    Joined:
    Apr 26, 2010
    Location:
    Newcastle, United Kingdom
    #3
    Thank you for replying.

    How do you clean a project?
     
  4. xStep macrumors 68000

    Joined:
    Jan 28, 2003
    Location:
    Less lost in L.A.
    #4
    Look under the Project menu. Also consider using the option key with it.
     
  5. MickeyT thread starter macrumors member

    Joined:
    Apr 26, 2010
    Location:
    Newcastle, United Kingdom
    #5
    That worked - thank you very much.

    Out of interest, what does cleaning actually do?
     
  6. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #6
    Normally when you build, it only builds files that you changed directly in Xcode... it has cached copies of files that you didn't change in Xcode. So if you modify a resource outside of Xcode, it won't reflect that when you build unless you also clean (it's to save time.)

    At least that's my understanding.
     
  7. MickeyT thread starter macrumors member

    Joined:
    Apr 26, 2010
    Location:
    Newcastle, United Kingdom
  8. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #8
    There are unfortunately some cases where Xcode keeps old resource files that you've removed from the project or target. Get in the habit of option-clean when you change resource files. Sometimes you will also have to remove the app from the device or Sim.
     
  9. KoolStar macrumors demi-god

    KoolStar

    Joined:
    Oct 16, 2006
    Location:
    Kentucky
    #9
    Sorry for the long delay in response. The shortcut is CMD+OPT+K to clean and its a necessity on all my builds almost every time resources or classes change.
     

Share This Page