I have the following code running fine on iOS 6.0 and iOS 7.0 where we set a logo (UIImageView) on a header (UIView).
Upon upgrading to SDK iOS7.1. The following stops working, and I have absolutely no idea why.
// Header
header = [[UIView alloc] initWithFrame: CGRectMake(0, baseYPos, self.view.viewSize.width, 50)];
header.backgroundColor = [UIColor blackColor];
[self.view addSubview: header];
// LOGO
UIImageView *logo = [[UIImageView alloc] initWithFrame: CGRectMake(0, 0, header.viewSize.width, header.viewSize.height - 20)];
logo.image = [UIImage imageNamed: @"logo.png"];
logo.alpha = 1;
logo.contentMode = UIViewContentModeScaleAspectFit;
logo.center = ccp(header.center.x, header.center.y - baseYPos);
[header addSubview: logo];
Using revealapp.com. Viewing the app in iOS7.0, I see the UIImageView as a floating logo (3D view in Reveal) above the header. Viewing the same app in iOS7.1, the UIImageView is basically a blank, transparent box with no image.
I've tried the following, all to no avail:
- declaring the UIImageView with initWithImage, and set the frame later
- force opaque on 'logo' to be FALSE, and TRUE for header
- instead of adding 'logo' as a subview to 'header', I added it to the parent view of both, inserting it as a subview above the header
None of this works. It looks as if Apple:
- changed the way we set images in UIImageView
OR
- changed the way we add UIImageView to a UIView parent
OR
- I've coded this totally the wrong way
I haven't been able to find any release notes on 7.1 to suggest it's an SDK change - it also makes for bad SDK design - "won't somebody please think of the children!"
This issue has me pretty stumped, so any help would be met with eternal gratitude (as in Free BEER kind :D).
Thanks all!