Tabbar背景图像不是完美放置

时间:2016-04-10 20:39:49

标签: objective-c uitabbarcontroller ios9 uitabbar

我有一个before substitution: section{First} section{second} after substitution: subsection{First} subsection{second} 当我将背景图片更改为使用此代码时我想更改其背景图片

UITabBarController

不改变self.tabBar setBackgroundImage:[UIImage imagenamed:@"texture.jpg"]];背景图像,而是更改整个屏幕背景图像。

Change Image of Red Rectangular Box Below Image2 Screenshot

2 个答案:

答案 0 :(得分:0)

使用此代码设置bg图像:

UIImage *tabBarBackground = [UIImage imageNamed:@"CustomUITabbar.png"];
[[UITabBar appearance] setBackgroundImage:tabBarBackground];

答案 1 :(得分:0)

AppDelegate设为tabBarController

后,在rootViewController中使用此代码
UITabBarItem *item = [self.tabBarController.tabBar.items objectAtIndex:0];
item.image = [UIImage imageNamed:@"YourDeselectImage.png"];
item.selectedImage = [UIImage imageNamed:@"YourSelectImage.png"];