Thanks
Thanks

Reputation: 40329

How high is a tab bar in iPhone OS?

I tried to get that info, but google returns me just nothing about that. Does anyone know that exactly? I remember a value around 40 units, but I am not sure. The Constants.h of UICatalog.xcodeproj doesn't mention it.

Upvotes: 5

Views: 3518

Answers (3)

Chris Prince
Chris Prince

Reputation: 7574

If you are like me, and don't like hardcoding these things, try:

UITabBarController *tabBar = [[UITabBarController alloc] init];
tabBarHeight = tabBar.tabBar.frame.size.height;

I put the first line in a utilities class (which is initialized at app startup), and just access tabBarHeight after that.

Upvotes: 0

Andres Bucci
Andres Bucci

Reputation: 947

You can also drop a

    NSLog(@"Tab Bar dimensions : %@", NSStringFromCGRect(yourTabBarController.tabBar.frame));

To see a string containing {{x, y}, {width, height}} wherever you alloc'ed the UITabBarController. You'll get 49 though, maybe this is overkill.

Upvotes: 1

user100531
user100531

Reputation:

If you mean the height then it is 49 px.

To find this I went into Interface Builder, created a blank view, then set Simulated Metrics -> Bottom Bar -> Tab Bar and noted the new dimensions of the view (320x431).

480 - 431 = 49px

Upvotes: 18

Related Questions