图像未显示在 Interface Builder/iPhone 的 UIImageView 中

Image not showing in UIImageView in Interface Builder / iPhone(图像未显示在 Interface Builder/iPhone 的 UIImageView 中)

本文介绍了图像未显示在 Interface Builder/iPhone 的 UIImageView 中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 UIView 和一个 UIImageView 拖到视图上.突然之间,对于我所有的 xib,图像不再显示.有一个蓝色的 X.但是,当它构建时,图像就在那里.

I have a UIView with an UIImageView dragged onto the view. All of a sudden, for all my xibs, the image no longer shows up. There is a blue X. However, when it builds, the image is there.

有一次,我删除并重新生成了所有图像,并将一些图像移到 Xcode 的子文件夹中.通常,当您为 UIImageView 选择图像时,IB 允许您从项目中的任何图像中进行选择.但是,我在下拉菜单中看不到我放在文件夹中的任何图像.

At one point, I deleted and regenerated all my images and moved some into a subfolder in Xcode. Normally, when you go to select an image for an UIImageView, IB allows you to pick from any image in the project. But, I can't see any of the images I had put in the folder anymore in the dropdown.

我在 Inspector 的下拉菜单中看到的只是我想要的一张图片,但这也是一张没有显示的图片.就像我说的,如果我在设备或模拟器上构建它,一切都会正常.

All I see in the dropdown on the Inspector is the one image I want, but that is also the one that is not showing up. And like I said, if I build it on the device or simulator, it all works.

有一些缓存或某处搞砸了.一切都建立起来没有错误.我清除了缓存并重建.这一切都有效.没有错误或警告.但是...我看不到任何其他图像,并且 IB 仍然认为它缺少在下拉列表中明确选择的图像.

There is some cache or something screwed up somewhere. Everything builds with no errors. I cleared the caches and rebuilt. It all works. No error or warnings. But...I can't see any other images and IB still thinks it's missing the image that is clearly selected in the dropdown.

那么我如何让 Xcode 和 IB 重回正轨,并查看它应该在 XIB 中正确看到哪些资产?

So how do I get Xcode and IB back on track and see what assets it properly should be seeing in the XIBs?

推荐答案

尝试清理并重建项目.

如果仍然无法正常工作,则从 Xcode 中删除所有图像(仅选择删除参考),然后通过将这些图像拖到 Xcode 中重新添加它们.然后重新构建它,它应该可以工作.

If it's still not working then remove all images from Xcode (select delete reference only) and then re-add them again by dragging those images into Xcode. Then re-build it and it should work.

这篇关于图像未显示在 Interface Builder/iPhone 的 UIImageView 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:图像未显示在 Interface Builder/iPhone 的 UIImageView 中

基础教程推荐