1

I have a custom UIView that gets reused throughout my app. It needs to know if a tab bar is currently being displayed so it can adjust itself when the keyboard is displayed.

I've tried calculating the difference in size between the superview and the app window, but that breaks when a navigation bar is also being displayed.

Is there a way for a custom view to determine if a tab bar is currently being displayed at a higher level in the app?

-or-

How can my custom view determine the true spacing from its bottom to the bottom of the window?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Fook
  • 5,320
  • 7
  • 35
  • 57

2 Answers2

2

get your current viewcontroller with this

and then ckeck if your tabbar is hidden or not

if currentViewController.tabBar.hidden == true {
   //tabbar is hidden
}
else{
   //tabbar is not hidden
}
Community
  • 1
  • 1
aytek
  • 1,842
  • 24
  • 32
0

Is something like this what you're looking for?

if ((tabBarController?.tabBar.hidden = true) != nil) {
        print("Hidden")
    }
    else {
        "Visible"
    }
MShahmeer
  • 159
  • 5