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.
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;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With