views:

54

answers:

2

Hi I am trying to add a subview to my iphone window and i have written the following code for that. Problem is that when the splash view or main menu view appears on the screen, it goes behind status bar. I mean the view starts from behind the status bar. Also both view overlap when the main menu view is show after the splash view. Can anyone please help? Thanks

- (void)applicationDidFinishLaunching:(UIApplication *)application {
       [window addSubView: [[Resources getResources] getSplashView]];
       [vindow makeKeyAndVisible];
       [self performSelector:@selector(displayMainMenuView) withObject:nil afterDelay:2.0];
  }


 -(void) displayMainMenuView {
       [window addSubView: [[Resources getResources] getMainMenuView]];`   
  }
A: 

Set the property statusBarHidden to YES when the splash view is displayed

- (void)applicationDidFinishLaunching:(UIApplication *)application {
       application.statusBarHidden = YES;
       [window addSubView: [[Resources getResources] getSplashView]];
       [vindow makeKeyAndVisible];
       [self performSelector:@selector(displayMainMenuView) withObject:nil afterDelay:2.0];
  }
MathieuF
HiThanks for the reply. The same thing happens when the main menu view is displayed. Is there anyway i can make this view display below the status bar, not behind it? I am working in Window based application.
Aqueel
If you want the statusBar always hidden set it to hidden in all your .xib files. And add the property "Status bar is initially hidden" set to YES in the Info.plist.
MathieuF
No i dont want to hide the status bar. I just want to show the status bar and the view should start from below the status bar. I just dont want my view to start from behind the status bar.
Aqueel
Open the .xib file in IB, in Simulated User Interface Elements add a statusBar
MathieuF
When i open my main menu screen, it already contains a status bar that is the status bar option in Simulated User Interface is set to Gray.
Aqueel
+1  A: 

You can also just adjust the frame of your main menu like:

mainMenuViewController.view.frame = CGRectMake(0.0f, 20.0f, 320.0f, 460.0f);

This will make your view just below the statusbar.

rckoenes