Kalai
Kalai

Reputation: 467

Hide tab bar issues in iPhone?

I am facing issues when hiding the bottom uiTabBar Controller.I am using the following code to hide.

 UITabBar *tabBar = self.tabBarController.tabBar;
UIView *parent = tabBar.superview;
UIView *content = [parent.subviews objectAtIndex:0];
UIView *window = parent.superview;

[UIView animateWithDuration:0.5
                 animations:^{
                     CGRect tabFrame = tabBar.frame;
                     tabFrame.origin.y = CGRectGetMaxY(window.bounds);
                     tabBar.frame = tabFrame;
                     content.frame = window.bounds;
                 }];

Its working fine.But in the main view i am having button and user clicks the button it opens the modal view controller as popup dialog.After cancel the pop up dialog the following screen will appear.

enter image description here

Upvotes: 0

Views: 260

Answers (2)

Kalai
Kalai

Reputation: 467

Yes I solved my problem

- (void)viewWillAppear:(BOOL)animated

{

// Get the size of the main screen
CGRect fullScreenRect = [[UIScreen mainScreen]bounds];

// Hide the tab bar
((UITabBarController *)self.parentViewController).tabBar.hidden = YES;

// Resize and fill the screen
[[((UITabBarController *)self.parentViewController).view.subviews objectAtIndex:0] setFrame:fullScreenRect];

}

- (void)viewWillDisappear:(BOOL)animated
{

    ((UITabBarController *)self.parentViewController).tabBar.hidden = NO;

}

When i am using the above code,It will work perfect :) :) :)

Upvotes: 1

Nilesh
Nilesh

Reputation: 91

Select the view controller for which you want to hide tab bar & Check 'Hide bottom bar on push'. enter image description here

Upvotes: 0

Related Questions