White space when hide bottom bar on push - ios

I have a tabBarController and when I push a view controller I am hiding the bottom bar to not show the tabBar in the second view controller. The problem is that I see a white space for a moment.
This is de code I am using to push the view controller
VerResultadoViewController *controller = (VerResultadoViewController *)[self.storyboard instantiateViewControllerWithIdentifier:#"ver_resultado"];
controller.hidesBottomBarWhenPushed = YES ;
[self.navigationController pushViewController:controller animated:YES];
This is the white space:

Call the hideBottomBarWhenPushed in viewWillAppear or viewDidAppear (can't remember what the correct one is; you have to experiment) of the controller you are pushing.

Related

Weird display issue when pushing from UITabBarController to UIPageViewController

https://drive.google.com/file/d/0B-LCl4SF8TXKUWVBMU9KZFEtYVU/view?usp=sharing (video link)
Refer to the title mentioned, I am having weird display issue when pushviewcontroller from UITabBarController to UIPageViewController.
I am having such views:
- UITabBarController
-- MoreViewController
push to
-AlertsPageViewController
with the following codes when I click "Alerts":
AlertsPageViewController *vc = [[UIStoryboard storyboardWithName:#"SBAlert" bundle:[NSBundle mainBundle]] instantiateViewControllerWithIdentifier:#"AlertsPageView"];
vc.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:vc animated:YES];
It leaves a big white space on the bottom of the screen with distorted tabbar at the bottom, until the "AlertsPageViewController" appear, only then it fill the gap below. When I click on "Back", the bottom bar also doesn't display probably. This behaviour only appear when I pushview to "UIPageViewController". If I push to normal "ViewController", it works correctly.
Tested on iOS9 and iOS10. How can I fix this?
Found out that other then using hidesBottomBarWhenPushed, another efficient way to hide the bottom bar is adding 1 line code
- (void) viewDidLoad
{
[self.tabBarController.tabBar setHidden:YES];
}
at the pushed view (AlertsPageViewController).

Why a apart of LoginViewController is hidden when adding it into NavigationController?

I don't understand this. On method didFinishLaunchingWithOptions, When I set self.window.rootViewController = <instance of LoginViewController>, it shows full of Login screen as expectation. But when I add LoginViewController into NavigationController and then set self.window.rootViewController = <instance of NavigationController>, a part on the top of the Login screen is hidden?
The reason is that, upper area of the view is being covered by navigation bar so you can hide it with this code
[[self navigationController] setNavigationBarHidden:YES animated:YES];
That's because, by default, the navigation controller has the navigation bar visible. To ensure that the navigation bar is hidden in your login screen, you should call in viewDidLoad() method of login screen view controller self.navigationController?.setNavigationBarHidden(true, animated: false)

Pushing a UITableViewController from a tabBarController embedded view doesn't remove tab bar?

I have a tab bar controller with 4 tabs and each tab is their own UINavigationController, which is how you're supposed to nest tab bar and navigation controller's together. The initial tab is a TableViewController and works/appears the way that it should. From the tableVC I can push standard view controller's onto the navigation controller with:
[self.navigationController pushViewController:VC animated:YES];
and it works properly.
If I attempt to push another TableViewController onto the navigation with the same method it works the same way, but the initial tab bar does not get pushed off screen like it should, it just stays in place.
Why would the tab bar stay on screen even though I am pushing a new VC onto the navigation?
I have tested with multiple instances of different TableVC's and it only happens with a table view controller.
Here is the code I'm using:
- (void)pushTableVC
{
TestTableVC *tableVC = [[TestTableVC alloc] init];
[self.navigationController pushViewController:tableVC animated:YES];
}
This will push the new table view onto the stack, but the tab bar from the parent VC stays in place and does not get pushed off screen like it should.
You should call the method setHidesBottomBarWhenPushed: on the view controller you are pushing to correctly hide the tab bar.
UIViewController *viewController = [[UIViewController alloc] init];
[viewController setHidesBottomBarWhenPushed:YES];
[[self navigationController] pushViewController:viewController animated:YES];
When you use a UITabBarController, the tab bar always stays on screen, even as you push additional view controllers onto an embedded UINavigationController. You will see this in any app that has a UITabBarController implemented, unless they implement custom behavior to change this.
The UINavigationController contains everything above the UITabBar, but does not contain the UITabBar itself, so it would not be able to push it offscreen.

Wired black space under screen when pop to previous view controller using UINavigationController

I am using UINavigationController to direct some view controllers.In some view controller, I don't want to use UINavigationBar, but in some others i may use. Now I am try to pop one view controller using UINavigationBar to its previous one which hide UINavigationBar. But when poped, there is one wired black space under screen. After you rotate the screen, the space will disappear.
the normal view controller A should be like this:
when press the text button, a view controller B will be pushed, which is as followings:
when click back button on the navigation bar. A will come out.but there is a black space at the bottom.
If rotate the screen, the space will disappear. And also in A's - (void)viewWillAppear:(BOOL)animated method i hide the navigationbar and let the screen autorotate.
- (void)viewWillAppear:(BOOL)animated
{
[self.navigationController setNavigationBarHidden:YES animated:animated];
[super viewWillAppear:animated];
[self willAnimateRotationToInterfaceOrientation:[UIApplication sharedApplication].statusBarOrientation duration:0];
}
whats wrong with this situation? Any help will be appreciated.
I add setNavigationBarHidden: method in the back button action method. it works. If i add this method in viewWillDisappear: method or others, it seems it doesn't work. The navigation bar will have effect on next appear view controller. which means, there will be a black space in the next view controller in the navigation stack.
Finally, i add a action method for the back button and setNavigationBarHidden:YES in the method, which is as follows:
- (void)backBtnClicked:(id)sender
{
[self.navigationController popViewControllerAnimated:NO];
[self.navigationController setNavigationBarHidden:YES];
}

UINavigationController's back button doesn't disappear when UIViewController is popped

I have this UINavigationController that when pushed automatically goes to landscape but can be changeable.
When I pop the view in portrait it goes back to the first/root view normally but when I pop the view in landscape, the back button remains and when I press it, it animates just like when popping a normal navigation controller and the button disappears.
I tried logging the view controllers whenever the main view appears and same with the second view, the logs that I got we're quite normal. On the first view only 1 view controller, and on the pushed view only 2 view controllers.
So, what could be the problem?
I'm not adding any custom buttons at all. It's the standard UINavigationController's back button.
Code:
Pushing the view controller
SomeViewController *rmVC = [[SomeViewController alloc] initWithNibName:#"SomeViewController" bundle:nil];
AppDelegate *ad = (AppDelegate*)[[UIApplication sharedApplication] delegate];
[ad.someNavigationController pushViewController: rmVC animated:YES];
This was done in this way 'cause this was pushed in a presentModalViewController
At someViewController's viewDidLoad
[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeLeft];
Pics
http://s1058.photobucket.com/albums/t411/shlbypuerto/

Resources