Skip to content
This repository has been archived by the owner on Apr 24, 2022. It is now read-only.

ViewPager doesn't account for a hidden tabBarController #112

Open
jpage4500 opened this issue Mar 5, 2015 · 0 comments
Open

ViewPager doesn't account for a hidden tabBarController #112

jpage4500 opened this issue Mar 5, 2015 · 0 comments

Comments

@jpage4500
Copy link

When displaying a view that hides the tab bar (eg: the "Hide Bottom Bar on Push" option in Interface Builder) the view has an empty area where the tab bar would be.

I think the fix would be to just check if the tab bar is hidden before subtracting it's height in the layoutSubviews method:

- (void)layoutSubviews {

    CGFloat topLayoutGuide = 0.0;

    CGRect frame = self.tabsView.frame;
    frame.origin.x = 0.0;
    frame.origin.y = [self.tabLocation boolValue] ? topLayoutGuide : CGRectGetHeight(self.view.frame) - [self.tabHeight floatValue];
    frame.size.width = CGRectGetWidth(self.view.frame);
    frame.size.height = [self.tabHeight floatValue];
    self.tabsView.frame = frame;

    frame = self.contentView.frame;
    frame.origin.x = 0.0;
    frame.origin.y = [self.tabLocation boolValue] ? topLayoutGuide + CGRectGetHeight(self.tabsView.frame) : topLayoutGuide;
    frame.size.width = CGRectGetWidth(self.view.frame);
    frame.size.height = CGRectGetHeight(self.view.frame) - (topLayoutGuide + CGRectGetHeight(self.tabsView.frame)) - CGRectGetHeight(self.tabBarController.tabBar.frame);
    self.contentView.frame = frame;
}

The line I'm referring to is the 2nd to last one:

CGRectGetHeight(self.tabBarController.tabBar.frame);
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant