1

I have issue with constrain using custom UITabBarController.

My solution to create custom tab bar it is find UITabBar in class that is subclass of UITabBarController and hide it. Instead of tab bar I use then UIView customised in the XIB.

In -viewWillAppear I hide my tab bar

- (void)hideExistingTabBar
{
    for (UIView *view in self.view.subviews)
    {
        if ([view isKindOfClass:[UITabBar class]])
        {
            view.hidden = YES;
            break;
        }
    }
}

Everything works perfect but not a constrain of table height. So in UIViewController that is attached as a first tab of my custom tab bar I have table that have constraint like on image below:

enter image description here

But as I have hide UITabBar in -viewWillAppear method it seems affect on the constraint immediately after removing. And after hiding seems the extremal bottom point is not tab bar origin y point but point of the bottom of the screen. And seems it is correct.

But my question is how can bind the constrain to my new custom view that is replace tab bar.

I found this answer. And seems it can be a solution, especially adding contentInset but it just solved a visual part. So the last cell right now is displayed when we scroll to the down, but the height of table view still the same.

Community
  • 1
  • 1
Matrosov Oleksandr
  • 25,505
  • 44
  • 151
  • 277

0 Answers0