Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xcode get UITabBar height

My app has a tabBarController as main controller and I need to get the height of tabBar from any view controller in order to calculate proper position for the rest of elements. How to get it programmatically? Thank you.

like image 617
Jaume Avatar asked Apr 19 '12 16:04

Jaume


1 Answers

I strongly suggest setting up your view hierarchy such that outer views are autosized by the container view and then more specific inner views can check the bounds of the outer layout view and lay themselves out appropriately at the appropriate times.

However, if your requirement makes that impossible (or extremely complicated and you really do need to specify points for everything), you can get the height of the tab bar with UIViewController's tabBarController property:

// from inside the view controller
CGSize tabBarSize = [[[self tabBarController] tabBar] bounds].size;
like image 133
Jason Coco Avatar answered Sep 21 '22 05:09

Jason Coco