I took a regular UITabBar
and changed it s background image to a custom one which has a lower height, so I changed the height
of the frame
.
At first what I got is a blank space below the tab bar. so I changed the origin
of the frame
too. But now the blank space has moved up above the tab bar and this is the result:
"https://i.sstatic.net/xPl7e.png" alt="标签栏以上的空间"/>
这是在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;
我想问题在于 Viewcurrent
将自己拖上一个常数空格上方, 这个常数空格是常规制表栏的高度。 是否有办法改变它?