Reputation: 29524
I've got this strange bug in my app. I'm making a subview and drawing it over the top of my main view. To get rid of it I'd just hide it. Here's the problem: There I can see part of the view underneath peeking through the bottom in a line that seems to be the same size as the status bar. I've put how I'm adding my subview below, along with a screenshot to illustrate my problem.
theLaunch = [[firstLaunch alloc] init];
[window addSubview:theLaunch.view]; // it goes on top
[window makeKeyAndVisible];
Here's the screenshot...the view underneath is grey.
Upvotes: 2
Views: 381
Reputation: 4985
It looks like you don't have subview properly 'anchored'. If in IB, then you could try attaching subview to bottom edge of containing view. Your 'main view' seems to be stretching to accommodate available space (which is changed by presence of status bar), while you 'sub view' appears to be positioned (0,0). Something like this might help:
Programmatically, you could use UIView's autoresizingMask. Something like:
theLaunch.view.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin;
How confident am I that this is the actual problem? Not as confident as I would like to be.
Upvotes: 3
Reputation: 16636
Your image probably has alpha transparency in the places where the image below shows through. If you don't want that effect, you should recreate the image without alphas (fully-opaque).
If you aren't able to recreate the image for some reason, you could try either setting the opaque property of the image view to YES (I'm not sure if that will work), or adding another view below your image view that is opaque and has a solid background color that isn't transparent.
Upvotes: 0
Reputation: 11914
Where are you defining your user interface for firstLaunch? If it's in a nib file, you need to have theLaunch = [[firstLaunch alloc] initWithNibName:@"firstLaunch" bundle:nil];
. If you are manually adding your interface elements; where are you doing that? If you're adding them manually in ViewDidLoad, I think you should be seeing it.
Upvotes: 0