Since i updated to iOS 7.1 the resizing of the tab (to 74 pixels) that doesn't work anymore:
[[tabBarController.view.subviews objectAtIndex:0] setFrame:CGRectMake(0, 0, 320, screenSize.height-73)];
[tabBarController.tabBar setFrame:CGRectMake(0, screenSize.height-73, 320, 74)];
This code results in the tab being moved up, but with some empty space bellow.
As anyone a fix for that ?
If you change the size of your UITabBar
in the viewDidLayoutSubviews
of your UITabBarController
subclass, the resizing works under iOS 7 and 7.1. Take my code as an example:
- (void)viewDidLayoutSubviews
{
CGFloat tabBarHeight = 39.0;
CGRect frame = self.view.frame;
self.tabBar.frame = CGRectMake(0, frame.size.height - tabBarHeight, frame.size.width, tabBarHeight);
}
this is what i currently use, I have removed the image from the tab bar, then i added this bit of code to position the text, I think the second line is obsolete but i keep it anyway. the for statement places your text in the bar, so u can adjust modifying the -25 value, 30 being the size of my tab bar height. The rest of the bar is technically "hidden" under the screen.
self.tabBar.frame = CGRectMake(0, screenHeight - 30, screenWidth, 30);
self.view.frame = CGRectMake(0, screenHeight - 30, screenWidth, 30);
for (int i = 0; i < self.tabBar.items.count; i++)
{
[[self.tabBar.items objectAtIndex:i] setTitlePositionAdjustment:UIOffsetMake(0, -25)];
}
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