问题
This is a continuation from original problem. Part of the original problem was solved and with new understanding I wanted to be able to restate the problem that still exists, acknowledge the problem that was solved, and provide more information on it and give a better title, due to new understanding.
My app is tab bar based, and has a UITabBarController that is created through the main nib (MainWindow.xib). Each tab references a UINavigationController, again created through the main nib (MainWindow.xib), and each UINavigationController has a root view controller created in the nib as well. Each of these UIViewControllers is a custom VC that has its own nib, class definition, etc.
The application is set (in the app plist) to have a translucent status bar. This works. The status bar is translucent. The first 4 tabs all have a custom background image (currently 2 images composited on the fly with the second being an overlay with < 1 alpha -- will eventually be replaced with a single composited image once development is done) in their individual VC and the last uses a standard background color chosen in its individual nib.
The translucent status bar should overlay the background image, as each image is currently set full size and upper left origin (320w x 480h -- will eventually be replaced with one that cuts out the tab bar at the bottom for efficiency and origin 0,0). However, this only happens in the first tab, and in the tab that uses a nib set background color/pattern.
Beyond the initial setting of the rootViewController in the app delegate did finish launch method,
[[self window] setRootViewController:[self tabBarController]];
there is no layout code in any of the VC. It is all defined in the nibs. (Yes I am old school)
Here are the two that work:
On the first image you can see that the "white" outline of the background image continues up along the sides and across the top of the status bar. On the second one you can see the background stripes continue up into the status bar.
Here is one of the three tabs that this does not work right on:
You can see that it does not have the white going up into the status bar and across the top. Instead of translucent black on blue it is just black.
Here are the shots from IB to show that they are all set up exactly the same
The root tab bar controller:
First Tab Navigation Controller and viewcontroller (which works correctly):
Second Tab Navigation Controller and viewcontroller (which does not work correctly):
I have been researching this and trying different things for a few days now and don't know what to try further. Everything appears to be set up identically and there is no layout or view altering code in the view controllers viewDidLoad
or viewWillAppear:
methods.
If there is anything obviously wrong (or not so obvious) I would appreciate a pointer. As far as I can tell it should work
来源:https://stackoverflow.com/questions/6782310/iphone-background-seems-to-be-clipped-out-from-under-translucent-status-bar-in