gpichler
gpichler

Reputation: 2381

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.

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.

This happens on devices running iOS 9.

enter image description here

These are the constraints for the UIImageView. I've removed the image, as it's a logo of a client.

enter image description here

enter image description here

Upvotes: 8

Views: 2438

Answers (3)

Priyanka Patil
Priyanka Patil

Reputation: 318

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.

Upvotes: 1

vcrim wu
vcrim wu

Reputation: 71

I have the same problem. I've tried:

  • move the .png file to Images.xcassets. fail.
  • create a new LaunchFile.storyboard. fail.
  • rename the .png file. work for a while, but after you perform the Build&Run action(same with Run without building action) a few times, the issues occur again. very weird.(sometime you need to reopen the Xcode to reproduce the issue)
  • test the same LaunchFile.storyboard in a new project. the LaunchFile is correctly displayed in the new project, very confused me.

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).

This issue is somehow related to the .png image. 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. 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.

Upvotes: 7

Vlad
Vlad

Reputation: 51

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.

Upvotes: 5

Related Questions