how to hide the title bar(top bar) in iphone from a view
Solution 1
The easiest way to hide the status bar is to go into youInfo.plist; right click to add a row and select Status Bar Initially hidden.
This will ensure every time you app launches the status bar will be hidden.
Edit
with programming
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
self.navigationController.navigationBar.frame = CGRectMake(0, 0, 320, 44);
and when you want to show the statusbar just use bellow code..
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];
self.navigationController.navigationBar.frame = CGRectMake(0, 45, 320, 44);
i hope this help you...
:)
Solution 2
In AppDelegate class applicationDidFinishLaunching ,write the below code
- (void) applicationDidFinishLaunching:(UIApplication *)application
{
[[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO];
}
All other views (except first View) when you need to display StatusBar, write the below code in curresponding ViewDidiLoad() / viewWillAppear
,
[[UIApplication sharedApplication] setStatusBarHidden:NO animated:NO];
Solution 3
in your info.pist find this option. "Status bar is initially hidden" And set as YES.
Comments
-
Raheel Sadiq about 2 years
Possible Duplicate:
Hide the status bar on iPhone on a single view?I want to hide the title bar in iphone from my first welcome view and also from the splash screen, how can i hide it(top bar, not the navigation bar).
I saw a post with this
[[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO];
but this hides the title bar through out the application. I just want to hide it from the first view.
-
Raheel Sadiq over 11 yearsit seemed great, when i read, but then i did like this, it gave me message that it is deprecated, although it did hide and displayed the status bar, but when i navigated to next page, the status bar was over my view and the my view was behind it not below it, any idea?
-
Raheel Sadiq over 11 yearsim using xcode 4.32 please read my comment on ramshad
-
Raheel Sadiq over 11 yearsi just want to hide it on my welcome view, it hide through out the app
-
Paras Joshi over 11 years[application setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone]; or [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone]; try this with delegate class
-
Paras Joshi over 11 years@mindFreezer see my edited answer...
-
Raheel Sadiq over 11 yearsJoshiyeah it worket great as my splashscreen and welcome screen were without status bar but as i do in viewWillDisappear " [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone]; " then the next view goes behind status bar not below
-
Paras Joshi over 11 yearsafter try to set frame of view..
-
Paras Joshi over 11 yearsalso reloadInputViews , i think your navigationbar not set to Top but just try to set as top to view with frame (0,0,320,44).. :)
-
Paras Joshi over 11 years@mindFreezer see my edited new answer...
-
Raheel Sadiq over 11 yearsits gud but cannot do this view resizing thing on every view after welcome screen , :(, i am thinking dropping this feature
-
Paras Joshi over 11 years-(void)viewWillDisappear:(BOOL)animated{ [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone]; }
-
Paras Joshi over 11 yearstry in above method and upvote if its some helpfu; to you... and try to add setStatusBarHidden:NO in viewWillDisappear: its work for me
-
Raheel Sadiq over 11 yearshahaha well your answer is true as well but my app situation not supporiting me , thanks
-
Paras Joshi over 11 yearsyou are always wel-come mate.. :) but again any new problem occur??
-
Raheel Sadiq over 11 yearsyeah, i have to set every view accordingly bcoz the view goes behind the title bar, so i left this things, coz already views are managed with difficulty, there is too much animation in my app, there is navigation bar and also tabbar, but i am hiding these with code , so there is already a mess