Weird display issue when pushing from UITabBarController to UIPageViewController - ios

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

Related

how to hide navigation bar + toolbar and change tableView height on scroll

I've got a view controller embedded in a navigation controller with a toolbar attached under it so it has this style:
as you can see with my storyboard, i also have a container view with a tableviewcontroller inside:
on scroll, i need to hide the navigation bar which I've been able to do. The problem is, I have to also hide the toolbar that is under the nav bar as well as expand the height of the table view so that when the nav bar and toolbar both disappear, the table view can use the extra space.
I don't have perfect answer but try to use below code in cellForRowAtIndexPath
will help you..
you did not mentioned weather your code is in objective C/ Swift. I am providing you Both ::
Obj-C
[[self navigationController] setNavigationBarHidden:YES animated:YES];
Swift
self.navigationController().setNavigationBarHidden(true, animated: true)
For tabBar, If you want to hide tabBar with navigationBar use this thing..
Or use this for tabBar hide >
DetailViewController *detailViewController = [[DetailViewController alloc] init];
detailViewController.hidesBottomBarWhenPushed = YES;
[[self navigationController] pushViewController:detailViewController animated:YES];
[detailViewController release];

White space when hide bottom bar on push

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.

Title and nav bar disappearing when launching view controller with code [duplicate]

This question already has an answer here:
presentViewController does not show Tab Bar or Navigation Bar
(1 answer)
Closed 7 years ago.
I am using following code to launch a view controller modally. This view controller is not being created from scratch. Rather, I created and styled it in storyboard, gave it a name, embedded it in a navigation controller so it has a navigation bar and created cancel and done buttons, gave it a title and the code below launches it.
The problem is that while most of the features of the screen show up such as labels and images, the title and navigation bar that you can see in the storyboard disappear. Has anyone come across this issue and have a fix for it?
My code to launch VC created in storyboard.
- (void) editView:(id) sender
{
NSLog(#"launch button pressed");
UIStoryboard *storyBoard = self.storyboard;
IDEditVC *editVC =
[storyBoard instantiateViewControllerWithIdentifier:#"editvc"];
editVC.item = _item;
[self presentModalViewController:editVC animated:YES];
}
I think what's happening is that since you are directly instantiating the view controller by name it's getting just that from the storyboard rather than embedding it in the nav controller.
Try this:
In your storyboard, make the Navigation Controller the initial/root View Controller for the storyboard
Instead of instantiating by name, use UIStoryboard's instantiateInitialViewController method.
EDIT:
Based on your comments below, you might want to try this:
- (void) editView:(id) sender
{
NSLog(#"launch button pressed");
UIStoryboard *storyBoard = self.storyboard;
IDEditVC *editVC =
[storyBoard instantiateViewControllerWithIdentifier:#"editvc"];
editVC.item = _item;
UINavigationController *nav = [UINavigationController alloc] initWithRootViewController: IDEditVC];
// Do whatever setup you want to here for your title bar, etc
[self presentModalViewController:nav animated:YES];
}
Try to use PushViewController instead of instantiate:
How to push viewcontroller ( view controller )?
Good luck

Storyboard UITableViewController enable toolbar at bottom of screen

I've created a storyboard based UITableViewController which is working and displaying data.
I now need to add a toolbar that will always be at the bottom of the screen. To do this I have added a toolbar button to my storyboard which has it positioned at the bottom of the screen.
I have added the following to my tableviewcontrollers viewWillAppear method
[self.navigationController setToolbarHidden:NO];
As described here
How to add a toolbar to the bottom of a UITableViewController in Storyboards?
However, I still get no toolbar...any ideas?
You want show toolbar in one view controller which placed in some navigation controller.
- (void)viewWillAppear:(BOOL)animated
{
//View will appear
[self.navigationController setToolbarHidden:NO animated:YES];
}
- (void)viewWillDisappear:(BOOL)animated
{
//View will disappear
[self.navigationController setToolbarHidden:YES animated:YES];
}

XCode/iOS: setToolbarHidden:animated creates new unwanted toolbar?

I'm trying to achieve something similar to user of this post:
Xcode/iOS: How to hide Navigation- AND ToolBar on scroll down?
I'm able to hide (or unhide using NO) the navigation bar successfully using the code:
[[self navigationController] setNavigationBarHidden:YES animated:YES];
However, when I attempt to hide the toolbar using the code:
[[self navigationController] setToolbarHidden:YES animated:YES];
Nothing happens. I then noticed when unhiding the toolbar that I received an additional blue toolbar that I didn't realize existed. This screenshot shows this:
Screenshot
I do not want the blue bar. What I am trying to do is hide or unhide the Black toolbar with the icons on it. (the UITabBar).
I think what I need to do is somehow I need to access the navigation controller of one of the parent view controllers and call the setToolbarHidden on the navigation controller of that view. However, I can't seem to figure out how to do this.
I've tried the following and all seem to have no effect:
[[[self parentViewController] navigationController] setToolbarHidden:YES animated:YES];
or
[[[[[[UIApplication sharedApplication] delegate] window] rootViewController] navigationController] setToolbarHidden:YES animated:YES];
My view controller storyboard consists of the following:
The InitialViewController is a TabBarViewController. It contains three children. One of those children is a UINavigationController. This navigation controller gets several UITableViewController pushed onto it, and eventually a UIViewController is pushed. This last UIViewController is what is seen in the screenshot.
Rough Layout:
TabBarViewController
UIViewController
UITableViewController
UINavigationController
UITableViewController
UITableViewController
UITableViewController
UIViewController
I've tried using
[self parentViewController] parentViewController] parentViewController] ...
to attempt to get back to the top, but this hasn't seemed to work either.
Any suggestions?
I think the problem here might be related to UITabBarController not having a UIToolbar. The setToolbarHidden: method will only apply to the UINavigationController's built-in toolbar (see Apple's documentation). If it's the UITabBarController's tab bar that you actually want to hide, take a look at this post which links to a method using UIView animations directly on the UITabBar.

Resources