I am having an app where I am hiding and showing tabbar on an event, below is the method I am using , when I try to hide it, it works fine . But when I am trying to make it visible it doesn't work.
-(void)setTabBarVisible:(BOOL)visible animated:(BOOL)animated completion:(void (^)(BOOL))completion {
// RootViewController* tabBarController = (RootViewController*)self.navigationController.parentViewController.parentViewController;
UITabBarController *tabBarController = self.tabBarController;
CGFloat duration = (animated)? 0.3 : 0.0;
CGRect frame = tabBarController.tabBar.frame;
CGFloat height = frame.size.height;
CGFloat offsetY = (visible)? -height : height;
CGRect playerFrame = player.view.frame;
CGRect toolBarFrame = self.toolbar.frame;
[UIView animateWithDuration:duration animations:^{
CGRect fr = CGRectOffset(frame, 0, offsetY);
tabBarController.tabBar.frame = fr;
if((!visible && ![self toolBarOnBottom]) || visible) {
self.toolbar.frame = CGRectOffset(toolBarFrame, 0, offsetY);
[self.toolbar layoutIfNeeded];
}
} completion:completion];
}
I when I debug code the second time I call this method to make it visible , the tabbar frame is zero , I think this is the problem. I am testing this on Xcode 9 with iOS 11 SDK. I am not sure if Safe area has anything to do with this.
Any help would be appreciated.