我正在尝试从我的启动屏幕中获得一个图像来显示为启动屏幕。故事板文件,但图像从不显示。我有标签显示良好,但图像不出现。
这是启动屏幕在启动屏幕中的外观。故事板文件:
然而,当我在模拟器(以及物理设备)上运行应用程序时,显示如下:
如您所见,标签“Test”显示良好,但图像没有显示。我真的不知道为什么会发生这种情况,我尝试的任何方法似乎都不起作用。如果任何人有任何关于如何解决这个问题的想法,这将是非常感激的。
我正在尝试从我的启动屏幕中获得一个图像来显示为启动屏幕。故事板文件,但图像从不显示。我有标签显示良好,但图像不出现。
这是启动屏幕在启动屏幕中的外观。故事板文件:
然而,当我在模拟器(以及物理设备)上运行应用程序时,显示如下:
如您所见,标签“Test”显示良好,但图像没有显示。我真的不知道为什么会发生这种情况,我尝试的任何方法似乎都不起作用。如果任何人有任何关于如何解决这个问题的想法,这将是非常感激的。
当前回答
I just figured this out. My launch image was not showing up, I get a white screen when launching on a device (iPhone 6, 7+) or testFlight. Fix: Renamed "Landing_screen.png" to just "Landing_screen" removing .png part. The image icon in Xcode changed to white icon and in the launch screen storyboard the image appears as a question mark now. The Launch image now appears and not the white screen. My Setup: I am using Swift 3.1 with Xcode 8.3.1. In LaunchScreen.storyboard I added a simple image view and stretched the image to fit the view controller. I set auto layout constraints Top/Bottom/Leading/Trailing space to superview to 0 - see image below:
其他回答
最后,重启电话对我有用!!
我在这个问题上花了好几个小时。尝试过更改图像名称,删除整个图像资产,修改信息。plist,重新启动Xcode,甚至试图设置所有的图像属性(你可以看出我是多么绝望)。
I just figured this out. My launch image was not showing up, I get a white screen when launching on a device (iPhone 6, 7+) or testFlight. Fix: Renamed "Landing_screen.png" to just "Landing_screen" removing .png part. The image icon in Xcode changed to white icon and in the launch screen storyboard the image appears as a question mark now. The Launch image now appears and not the white screen. My Setup: I am using Swift 3.1 with Xcode 8.3.1. In LaunchScreen.storyboard I added a simple image view and stretched the image to fit the view controller. I set auto layout constraints Top/Bottom/Leading/Trailing space to superview to 0 - see image below:
有同样的问题,将图像添加到“构建阶段->复制捆绑资源”为我修复了它。
在我的例子中,启动画面适用于模拟器和其他设备,但不适用于某一特定设备。这让我相信这是xcode (v10和iPhone 7 v12.1)保存的一些缓存数据。
我在~/Library/Developer/Xcode/DerivedData/删除了派生数据,只清空文件夹内容,而不是删除文件夹。然后我重启了mac和iPhone,清理并重建了这个项目,现在它出现了。
我不确定所有这些是否都是必要的,但我不想浪费更多的时间来缩小范围,所以上面的大锤方法对我来说很有效。当然,这总是取决于你的具体情况——我的是特定设备;对于其他人来说,它可能是实际的图像或启动屏幕布局等。
我尝试清理项目,删除png,删除约束,但对我来说没有用。
我只是做了一个图像的副本和重命名的副本,然后删除旧的图像,并添加了新的图像(相同,与名称更改),我只是给了那个图像,它为我工作。
我也没有使用资产。Xcassets,使用文件夹中的图像。