如何自定义我的Tabbar控制器图标(背景图像)?

时间:2012-07-12 11:50:41

标签: iphone ios ipad

enter image description here

我有一个iphone应用程序,我想在其中显示我自己的图像作为tabbar图标。但现在只有默认的greyone即将到来。我需要将它更改为我自己的图像吗?。我经历了很多链接,但似乎没有什么是非常明确的。任何人都知道如何实现这一目标?

2 个答案:

答案 0 :(得分:1)

请从here下载源代码,并根据您的要求更改图片。

答案 1 :(得分:0)

您可以在tabBarItem上设置图像,如下所示: -

tabBarController = [[UITabBarController alloc] init];
tabBarController.delegate = self;
ViewController *viewObject= [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
UINavigationController *navView = [[UINavigationController alloc] initWithRootViewController: viewObject];
UITabBarItem *tabBarItem = [[UITabBarItem alloc] initWithTitle:@"Tutorial" image:[UIImage imageNamed:@"kb-emoji-U+E031.png"] tag:1];
navView.tabBarItem = tabBarItem;
tabBarController.viewControllers = [NSArray arrayWithObjects:navView,nil];
self.window.rootViewController = tabBarController;

另请参阅此链接 - click me

相关问题