开发者

iphone 4 - Application doesn't show image?

I've had this app on app store with no problem until iphone 4 came out. My home page has an image covering the whole screen.

UIImageView added in interface builder, and image path added in interface builder.

In all phones this image shows up; however, the image does not show up in any iphone 4, and instead the user sees a blank screen like the following: Anybody knows what's causing this? thanks

iphone 4 - Application doesn't show image?

.

  • I only have 1 set of images with normal resolution

  • This problem only happens to one of the images in my application which is the background for my home page

  • th开发者_C百科e graphic file should not be corrupted because the exact same image works for all other iphones and itouches

  • my image is a jpg file

  • image size is 480x270, which in interface builder i make it 563x330 to display only a part of it

  • I have no outlet to this uiimageview so it cannot be changed in code


With devices with the new retina display, pixel sizes are different and you have to check for the following, in particular:

  • Do you provide two alternatives of the image, one at old resolution, one at double resolution (named myimage.png and myimage@2x.png)
  • If not, does your image scale up well in size with CoreGraphics's algorithms (there are some pathological cases, though you'd have to be quite unlucky)?
  • Have you checked what happens (at both resolutions) when your UIImageView size changes?
  • Is it just one image, or all?
  • Is your graphics file corrupted?

It's hard to tell if it's any of these points, or something else, because you provide so damn little detail, that I stick to generic things. Comment below (or edit your question) if you need more help.


I've got two things to add to FXs thorough answer:

  1. Considering the information you added, I would take a look at your code for setting up that UIImageView. Perhaps you use some sort of detection code or something which wasn't implemented correctly.

    Would you mind sharing some code snippets?

  2. According to Apple's documentation, you don't need to provide the ".png" extension as of iOS 4. Perhaps that is causing the problem.

    Again, code snippets would help here. Specifically where you deal with loading up your image file.

EDIT:

Try re-saving the image and replacing it. I've occasionally corrupted files in Photoshop. This has to do with file extensions and how Mac OS ignores them, but Photoshop still uses them.

Also, it could have to do with where the image is in your XCode project. Check what Group it is in. Make sure everything is in place and then Clean and Rebuild. Remove the app from the iPhone4 (reboot) and try reinstalling.

I hope this helps.

Good luck!


If this was my code, I'd write a tiny app just to display the image in question. If it still fails it would be easier to get help debugging the problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜