UIView is not autoresized after I hide the UIStatusBar - ios

I have a ViewController which need to hide the status bar sometimes. The problem is the view of the UIViewController is not autoresized after the status bar is hidden. (Actually I have another application use the exactly the same View Controller. Which has no problem at all). Can anybody advise which could be the cause of the problem? Thanks
Please refer to my screen shots. The first one is the view before I hide the status bar and the navigation bar. The second one is after I hide the status bar and navigation bar. You can see that the there is obvious black area which previously occupied by status bar.

Seems wantsFullScreenLayout of your view controller isn't set to YES.

[self.navigationController.navigationBar setBarStyle:UIBarStyleBlackTranslucent];
[self setWantsFullScreenLayout:YES];
Try this in your viewDidLoad.
Additionally to full screen layout I think the bar style must be traslucent.

Related

Hide tab bar containerview

I have a tab bar controller and in one of my views I want that tab bar hidden. I selected BottomBar - none in interface but when my view appears there is still a white outline at the bottom of this view. I have a container view at the bottom of this view that I want extended all the way to the bottom of the screen. There is also a navigation controller embedded after the tab bar going into this view. Not sure if that makes a difference. Any suggestions? Thanks in advance. There are some photos of what I'm talking about below.
try on viewDidLoad
[self.tabBarController.tabBar setHidden:YES];

Can't make UITableView appear under translucent navigation bar

I'm trying to use a translucent navigation bar and want to put my table view (in a UITableViewController) under the navigation bar but without success.
I've been searching all over the web but I'm only finding help on how to push the content below the navigation bar which is exactly the opposite of what I'm trying to do.
I have Under Top Bars checked inside my storyboard.
Please help!
set
self.automaticallyAdjustsScrollViewInsets = NO
in viewDidLoad and then check

UISearchBar and UINavigationBar from navigation controller disappearing when searching

I have a UINavigationController with a UISearchBar right under the UINavigationBar. When I click in the search bar, the text and buttons on the UINavigationBar disappears, but the blank white bar still stays. I think this is because it is a navigation controller and so the navigation bar can disappear. In addition, when I start typing, the search bar disappears, but I can still type. My question: is there a way to either make the entire navigation bar disappear when I start searching or make the text on the navigation bar stay while searching, and how do I ensure the search bar does not disappear? Thanks.
self.searchController.hidesNavigationBarDuringPresentation = NO;
Figured it out. In the storyboard, I had to click on the little icon on the bottom, third from the left, then "resolve auto layout issues." Autolayout must be off for this to work

Replace status bar with own view

I would like to replace the UIStatusBar in my app with my own view.
I'm assuming that I need to hide the status bar - is this right?
The problem with hiding the status bar is that the navigation bar moves up to occupy it's original position. How can I add my view and move everything back down 20 px?
Assuming that I don't have to remove the status bar, but instead can just cover it with my view, I then have the problem of the background color. This changes between views, so I would need to mask out the existing status bar text - how do I do this?
Thanks for your help.
Your approach is correct with a little tweak with self.view's frame.
Add below method to your viewController,
-(void)viewWillLayoutSubviews{
[super viewWillLayoutSubviews];
self.view.frame =CGRectMake(0, 20, 320, [UIScreen mainScreen].bounds.size.height);
}
Above method moves your view by 20 pixels down.
The first step would be to hide the status bar. In iOS 7, you can do this by adding the prefersStatusBarHidden function, like so:
- (BOOL)prefersStatusBarHidden {
return YES;
}
This will hide the status bar.
To fix the movement issue you mentioned, you need to set the status bar style for the viewController to none (in the interface editor).
Start off by selecting the View Controller in the left side panel:
Head over to the Attributes Inspector on the right side of Xcode, and set Status Bar to none:
That's it, now you can add your own view at the top of the screen with your own content :)
To hide the status bar completely in iOS7, set "View controller-based status bar appearance" to NO in Info.plist, and [[UIApplication sharedApplication] setStatusBarHidden:YES]; in application:didFinishLaunchingWithOptions
I think you are using autolayout. So for doing that just place all of your views inside another view and in delta y put 20px for ios6/7. and don't forget to follow Audun Kjelstrup's step. Hope it will solve your problem.

iOS ChildViewController in UINavigationController = show StatusBar

I have stumbled across a weird problem when implementing a view container which is connected with child view controllers.
The hierarchy is the following:
I have a UISplitViewController and in the MasterViewController I added a view container which is connected to a UIViewController which is embedded in a UINavigationController.
The outcome is the following:
The ChildViewController leaves a white space at the top which seems to be exactly as high as the status bar. How can I avoid that the status bar frame is shown in the child view controller?
I tried to set wantsFullScreenLayout for the ChildViewController and for its UINavigationController but it doesn't change anything.
I also tried to set the y offsets of the views to -20.0 points but that ends up in another problem.
Only when I set status bar hidden for the application it is not shown for the ChildViewController but that in turn also hides the status bar at the top of the UISplitViewController.
Would be glad for some hints.
Basically it looks like the top gap is the status bar. The statusbar at the moment is 'light' colored which is why it's not showing on top of the white background. Try changing the background color of the view controller to black or use one of the appearance callbacks to change the status bar to a darker color.

Resources