[英]UIImageView is black on launch screen
I sometimes face a very strange issue on launch screen. 我有时在启动画面上遇到一个非常奇怪的问题。 I'm using a xib file with just a UIImageView
on it, however sometimes the image is just a black rectangle. 我正在使用一个只带有UIImageView
的xib文件,但有时图像只是一个黑色矩形。
I've tried to switch between .jpg and .png files but this didn't help, I've also assigned a different image property profile to it. 我试图在.jpg和.png文件之间切换,但这没有用,我还为它分配了一个不同的图像属性配置文件。
This happens on devices running iOS 9. 这种情况发生在运行iOS 9的设备上。
These are the constraints for the UIImageView
. 这些是UIImageView
的约束。 I've removed the image, as it's a logo of a client. 我删除了图片,因为它是客户的徽标。
I have the same problem. 我也有同样的问题。 I've tried: 我试过了:
Finally, i found a way which works not only for temporary(I've tested for one hour, just repeat build and run for like 100 times, watch TV meanwhile). 最后,我发现了一种不仅适用于临时工作的方式(我已经测试了一个小时,只需重复构建并运行100次,同时看电视)。
This issue is somehow related to the .png image. 此问题与.png图像有某种关联。 I dragged my .png file to photoshop, then go File > Save for web (Command + Option + Shift + S), make sure the transparency is unchecked, export a new .png file. 我将.png文件拖到photoshop,然后转到File> Save for web(Command + Option + Shift + S),确保未选中透明度,导出新的.png文件。 replace the old file with then new one you'll find the issue is fixed. 用新的文件替换旧文件,你会发现问题已修复。
But I'm still confused why a issued .png file can work for a while. 但我仍然困惑为什么发布的.png文件可以工作一段时间。
I have the same problem that appears from time to time on some devices. 我有一些设备上不时出现的问题。 Last thing that helped was a full restart of a device. 最后一件事就是完全重启设备。
Not sure what the original issue was really, I fixed it by manually generating legacy splash screens though. 不确定原始问题是什么,我通过手动生成传统启动屏幕来修复它。
One issue with debugging that may be helpful was that it persisted when updating the build (even when the app was deleted) until I both deleted the app and shut down the device. 调试可能有用的一个问题是,在更新构建时(即使应用程序被删除)它仍然存在,直到我删除应用程序并关闭设备。 I guess the splash screens are getting cached and so this clears the cache. 我猜飞溅屏幕正在缓存,因此清除了缓存。 I hope this helps save some folks some time, if anyone knows why this was happening, I'd still be happy to know. 我希望这有助于拯救一些人,如果有人知道为什么会这样,我仍然很高兴知道。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.