iphone 4 - 应用程序不显示图像?

发布于 2024-09-29 06:22:01 字数 566 浏览 8 评论 0原文

在 iphone 4 推出之前,我一直在应用程序商店中使用这个应用程序,没有出现任何问题。 我的主页有一张覆盖整个屏幕的图像。

界面构建器中添加了 UIImageView,界面构建器中添加了图像路径。

在所有手机中都会显示此图像;但是,该图像不会在任何 iphone 4 中显示,而是用户看到如下所示的空白屏幕: 有人知道是什么原因造成的吗?谢谢

store

  • 我只有 1 组图像 正常分辨率

  • 此问题仅发生在其中之一 我的应用程序中的图像是 我的主页背景

  • 图形文件不应该是 已损坏,因为完全相同 图像适用于所有其他 iPhone 和 触摸

  • 我的图像是 jpg 文件

  • 图像大小是 480x270,其中 界面生成器我将其设置为 563x330 以仅显示其中的一部分

  • 我没有此 uiimageview 的出口 所以不能在代码中更改

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

store

.

  • 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

  • the 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

ζ澈沫 2024-10-06 06:22:05

如果这是我的代码,我会编写一个小应用程序来显示有问题的图像。如果仍然失败,那么获得调试问题的帮助会更容易。

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.

忘东忘西忘不掉你 2024-10-06 06:22:04

对于配备新视网膜显示屏的设备,像素大小会有所不同,您必须特别检查以下内容:

  • 您是否提供了两种图像替代方案,一种为旧分辨率,一种为双分辨率(名为 myimage.png[电子邮件受保护]
  • 如果没有,您的图像是否可以通过 CoreGraphics 的算法很好地放大尺寸(有一些病态的情况,尽管您必须非常不幸)?
  • 您是否检查过当 UIImageView 大小发生变化时会发生什么(在两种分辨率下)?
  • 是只有一张图片还是全部?
  • 您的图形文件是否已损坏?

很难判断这是这些要点中的任何一个还是其他什么,因为你提供的细节太少了,所以我坚持通用的东西。如果您需要更多帮助,请在下面发表评论(或编辑您的问题)。

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 [email protected])
  • 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.

飘过的浮云 2024-10-06 06:22:04

我有两件事要添加到 FX 的完整答案中:

  1. 考虑到您添加的信息,我会看一下您用于设置 UIImageView 的代码。也许您使用了某种检测代码或未正确实现的东西。

    您介意分享一些代码片段吗?

  2. 根据 Apple 的文档,从 iOS 4 开始,您不需要提供“.png”扩展名。也许这就是导致问题的原因。

    同样,代码片段在这里会有帮助。特别是在处理加载图像文件的位置。

编辑:

尝试重新保存图像并替换它。我偶尔会损坏 Photoshop 中的文件。这与文件扩展名以及 Mac OS 如何忽略它们有关,但 Photoshop 仍然使用它们。

此外,它可能与图像在 XCode 项目中的位置有关。检查它所在的组。确保一切就位,然后清理并重建。从 iPhone4 中删除该应用程序(重新启动)并尝试重新安装。

我希望这有帮助。

祝你好运!

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!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文