uiimageviewpngalphalaunch-screenxcode9.3

Xcode 9.3 Launchscreen.storyboard looses alpha channel in UIImageView PNG when executing


I have a PNG file in the Xcode project navigator. It has an alpha channel (rounded corners icon style).

I have initialised a UIImageView in the Launchscreen.storyboard with this PNG file. See screenshot.

Launchscreen.storyboard

When I run the Simulator the alpha channel (the rounded corners) have disappeared. See screenshot.

Simulator Launchscreen

Am I doing something wrong or is this a bug in Xcode 9.3.1?


Solution

  • When you drag a new UIImage to a storyboard, by default the Opaque property is set to true. Turning this off in the attribute inspector and also setting the background color of the UIImage to clear made the png file appear correctly in the simulator.