Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the height of the tabbar programmatically?

I've found out that the height of a UITabBar is 49px (or 50px, depending on the source).

Because I don't like to use too much hard-coded values in my code I was wondering if it is possible to retrieve the height of the tabbar programmatically.

Kind regards,
Niels R.

PS: The reason I'm asking is because I have a view controller (with a list view containing text fields) that is either simply pushed by the navigationcontroller (pushViewController) or presented as a modal (presentModalViewController). As soon as the keyboard show up, the size of the view is reduced, but I have to take into account that the tabbar is only visible when the view controller is pushed and not presented as a modal.

like image 675
Niels R. Avatar asked Mar 22 '11 07:03

Niels R.


1 Answers

I don't totally understand your P.S., but you can do:

tabBarController?.tabBar.frame.size.height 
like image 126
Mason Avatar answered Sep 30 '22 23:09

Mason