Interface Builder 在视网膜图像上挂起

发布于 2024-11-16 03:25:47 字数 278 浏览 2 评论 0原文

在我的应用程序中,我为图像“Standard”和“Retina”创建了 2 个文件夹,其中我为应用程序放置了很多图像。当我打开我的一个 xib 文件时,Interface Builder 挂起...

我发现如果我删除该 xib 使用的 Retina Image,那么 IB 将打开 xib,没有任何问题...此问题仅出现在 1 个 xib 文件中,可以打开另一个xib文件,没有任何问题。挂断的原因可能是什么?形象会不会很差?或者也许我不应该将视网膜图像放入“Retina”文件夹?可能是什么原因?

谢谢...

In my app I create 2 folders for images "Standard" and "Retina" where I put a lot of images for my app. When I open one of my xib file, Interface Builder hang up...

I found that if I remove Retina Image that is used by this xib, then IB will open xib without any problem... This problem occurs only with 1 xib file, another xib files can be opened without any problems. What can be the reason of hang up? Can image be bad? Or maybe I shouldn't put Retina Images to "Retina" folder? What can be the reason?

Thanks...

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

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

发布评论

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

评论(4

痴意少年 2024-11-23 03:25:47

当您在目标上编译并运行应用程序时,您将收到有关缺少哪个图像的警告。手动删除该图像并将其添加到您的项目中。这应该可以解决您的挂起问题。

When you compile and run your application on target you will get a warning on which image is missing. Delete and add that image to your project manually. This should solve your hang issue.

初见你 2024-11-23 03:25:47

你如何命名你的视网膜图像?它应按以下格式命名:<您的图像名称>@2x.png。其次,确保您在目标的构建阶段看到这些图像。
至于您的 xib,它挂起,请检查您使用的名称是否与非视网膜图像相同。 IB 知道在运行时用视网膜显示的图像来改变这些图像。当然,请检查您是否没有使用项目中没有的图片名称。

How do you name your retina images? It should be named in the following format: <your image name>@2x.png. Second be sure you see these images in the build phase of your target.
As for your xib, that hangs, check that names you use are the same as for non-retina images. IB knows to change these images in run-time with these of retina display. And of course check that you don't use there names of pictures, that you don't have in the project.

屋顶上的小猫咪 2024-11-23 03:25:47

如果您使用“黄色文件夹”,那么它们不是实际的文件夹。它们仅用于在 XCode 中组织文件的目的。其次,您应该在界面生成器中使用普通的iPhone图像,它会自动定位@2x图像,所以如果您使用“蓝色文件夹”并分离图像,我认为它可能很难理解它当它在非视网膜屏幕上时应该查看“标准”,当它在视网膜屏幕上时应该查看“视网膜”,因为你从来没有告诉过它这样做。

If you are using "yellow folders" then they are not actual folders. They only serve the purpose of organizing your files in XCode. And second, you should use the normal iPhone image in interface builder and it will automatically locate the @2x image, so if you are using the "blue folders" and separating the images, I think it probably will have a hard time understanding that it should look in "standard" when it is on a non-retina screen and "retina" when it is a retina screen, because you never never told it to do that.

悲念泪 2024-11-23 03:25:47

您只能通过名称结尾来区分视网膜和非视网膜图像:
正常情况下为图片.png
[电子邮件受保护](适用于视网膜)
我通常将它们放在同一个文件夹中,这样我就可以轻松查看哪些图片支持视网膜。

使用 [UIImage imageNamed:@"picture.png"] 将首先尝试加载 [email] protected] 如果您的应用在具有视网膜显示屏的设备上运行。如果无法加载 2x 版本,它将使用 picture.png。

You distinguish retina and non-retina images only by their name ending like:
picture.png for normal
[email protected] for retina
I usually put them into the same folder so i can easily see what pictures have retina support.

Using [UIImage imageNamed:@"picture.png"] will at first try and load [email protected] if your app runs on a device with retina display. If it cannot load the 2x version, it will use the picture.png.

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