neobie neobie - 10 days ago 5
iOS Question

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?

Answer

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).

Comments