I took a regular UITabBar
and changed its background image to a custom one that has a lower height, so I changed the height
to frame
. First, I got an empty space under the tab bar. so I changed the origin
value for frame
. But now the empty space has risen above the tab bar, and this is the result:
And this is the code declaring the tab bar in AppDelegate:
self.tabContoller = [[UITabBarController alloc] init]; //customizing the tabbar UIImage * tabBackgroundImage = [UIImage imageNamed:@"tabBarBg.png"]; self.tabContoller.tabBar.backgroundColor = [UIColor colorWithRed:245.f/255.f green:245.f/255.f blue:245.f/255.f alpha:255.f/255.f]; self.tabContoller.tabBar.backgroundImage = tabBackgroundImage; //setting the tabbar height to the correct height of the image CGRect tabR = self.tabContoller.tabBar.frame; CGFloat diff = tabR.size.height - tabBackgroundImage.size.height; tabR.size.height = tabBackgroundImage.size.height; tabR.origin.y += diff; self.tabContoller.tabBar.frame = tabR;
I suppose the problem is that the ViewController
extends over a constant space, which is the height of the regular tab bar. Is there any way to change it?
source share