相关疑难解决方法(0)

自定义UITabBar和ViewController之间的空间

我经常UITabBar把它的背景图像改成了一个高度较低的自定义图像,所以我更改了heightframe.我首先得到的是标签栏下方的空白区域.所以我改变了originframe了.但是现在空白区域已经向上移动到标签栏上方,这就是结果:

标签栏上方的空间

这是在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;
Run Code Online (Sandbox Code Playgroud)

我想问题是,ViewControllers将自己绘制在一个恒定空间之上,这是常规标签栏的高度.有没有办法改变它?

iphone objective-c uitabbarcontroller uitabbar ios

6
推荐指数
2
解决办法
3047
查看次数

标签 统计

ios ×1

iphone ×1

objective-c ×1

uitabbar ×1

uitabbarcontroller ×1