Images not displaying on device, OK in simulator

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
seamus_waldron
Posts: 11
Joined: Mon Dec 13, 2010 4:12 pm

Images not displaying on device, OK in simulator

Post by seamus_waldron » Wed Dec 21, 2011 6:35 pm

My stack is designed in the LiveCode environment for a regular (non retina) iOS display

My directory structure look like this:

./assets/iphone/
.assets/iphoneX2/

The stack uses images from ./assets/iphone/ and the images in the iPhone and iphoneX2 directory have the same names, just different dimensions for the different screen sizes.

If I detect that I am running on a retina display, my code loops through all my images and replaces /iphone/ in the filename with /iphoneX2/

I then re-position the images and various other positioning things

In the simulator, this all works just fine. The retina images get brought in and the app works fine.

The moment I deploy to a retina device, I hit trouble. None of the images display.

They are definitely being copied over to the device, so that is not the problem.

Any suggestions to get these images to show would be most gratefully received!

Regards

Seamus

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7389
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Images not displaying on device, OK in simulator

Post by jacque » Wed Dec 21, 2011 9:39 pm

This is almost always a file path issue. What are you using in your script to get the image paths? is it using specialFolderPath("engine") rather than the dot-slash at the front?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

seamus_waldron
Posts: 11
Joined: Mon Dec 13, 2010 4:12 pm

Re: Images not displaying on device, OK in simulator

Post by seamus_waldron » Wed Dec 21, 2011 10:50 pm

Bingo!

I am kicking myself as this was a solution I solved 10 months ago for getting to audio files and I had completely forgotten.

So,my code looks like this:

Code: Select all

   repeat with x = 1 to the number of images on this card
      put the topLeft of image X into localTopLeft
      put the filename of image X into  localFilename
      
      replace "iphone" with "iphoneX2" in localFilename
      replace "./assets/" with specialFolderPath("engine") & "/assets/" in localFilename
      
      set the filename of image X to localFilename 
      
      set the topleft of image x to localTopLeft
   end repeat
In essence, what this does is loop through all the images on the card and replaces them with the X2 version.

Many thanks for the tip.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7389
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Images not displaying on device, OK in simulator

Post by jacque » Wed Dec 21, 2011 11:01 pm

I wish I only forgot one thing. :)
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply