我正在尝试从我的启动屏幕中获得一个图像来显示为启动屏幕。故事板文件,但图像从不显示。我有标签显示良好,但图像不出现。

这是启动屏幕在启动屏幕中的外观。故事板文件:

然而,当我在模拟器(以及物理设备)上运行应用程序时,显示如下:

如您所见,标签“Test”显示良好,但图像没有显示。我真的不知道为什么会发生这种情况,我尝试的任何方法似乎都不起作用。如果任何人有任何关于如何解决这个问题的想法,这将是非常感激的。


当前回答

按照以下步骤,

从设备中删除应用程序 重启设备 再次构建

如果不工作,删除派生数据。>Locationtab->派生数据。然后按照上面的步骤去做。

其他回答

在投入了大量的时间后,我得到了解决方案:-

Step 1:- Quit Xcode
Step 2:- Delete the app from device/simulator
Step 3:- Restart your device (if you are using simulator then you have to quit simulator)
Step 4:- Clear all derived data 
Step 5:- Clear Bin
Step 6:- Open Xcode and relaunch the app, it will work 

You have to make sure that the file name of your image has a format like .png or .jpg at the end otherwise it will not work. Also, before adding your image, you have to make sure that the image file is in your "Assets.xcassets" folder within your project. This can be done with a simple drag and drop. Also, make sure when you've added your image to your storyboard that the image name in the top left also matches the real image file name. I would try looking into Constraints too. Hope this helps. Good luck with your App.

我的第一个错误是,我创建了一个普通的.storyboard,重命名它,并在项目设置中将其定义为launchscreen。在这个案子里,我的形象有问题。在这种情况下,似乎有些设置缺失了,所以我只是通过file->new创建了一个新文件,并直接选择“启动屏幕”,然后它就工作了。

此外,我还考虑到,由于某些原因,布局限制在启动屏幕中不受支持。也许一开始是这样的,不确定,但现在约束应该起作用了。

也许这对任何人都有帮助。

这恰好是XCode/iOS中的缓存问题,但有一个简单的修复方法:在Assets中重命名文件。Xcassets,这样缓存就会重新生成。

正在改变背景图像的启动屏幕和新的图像不显示(反应原生项目)。

根据别人的回答。

我做了以下所有的事情,它是固定的:

清洁的构建。 从模拟器中删除应用程序 退出模拟器 重启XCode 再次运行app