I need to load a various PNG images in my app natively within a CALayer. To do this, my code is something like the following:
CALayer *myLayer = [[CALayer alloc] init];
UIImage *myImage = [UIImage imageNamed:@"nonTransparentBackground"];
[myLayer setOpaque:YES];
[myLayer setContents:(__bridge id)[myImage CGImage]];
UPDATE 15.04.2015: I created a test app that does nothing apart from load a PNG file in the backgrounds and it works which is good news. There must be something somewhere in my app causing this behaviour. Hopefully it won't take too long to identify.
I'm posting here in case someone has the problem in the future, but I doubt it. It turns out the problem wasn't related to my actual code but the Deployment Target. My current target is 7.1 but by changing to 8.0, it works as expected. I've no idea is that is Xcode/Simulator related or iOS related however so I'll probably stick with iOS 7 until the next update.