I am trying to add UITabBarController
programmatically. Everything is working fine but I am having two issues.
- I am setting tabbar background image but it shows a different image which I dont even have in resources.
I am using this image as tabbar background image with a green line above :
But it shows another green line at bottom like this:
Here is the code I am using for this:
[self.myTabBarController.tabBar setBackgroundImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"tabbar.png" ofType:nil]]];
Another issue is, I am setting tabbar item images using this code:
MyViewController *myController = [[MyViewController alloc] initWithNibName:@"MyViewController" bundle:nil]; UINavigationController *myNavController = [[UINavigationController alloc] initWithRootViewController: myController]; [myNavController.tabBarItem initWithTitle:@"" image:[UIImage imageNamed:@"ads_inactive.png"] selectedImage:[UIImage imageNamed:@"ads_active.png"]];
Images are set but when i try to add title in MyViewController
's viewDidLoad
using this:
self.title = @"My Ads";
It shows same title on tabbar item too but I dont want any title there.
How I can fix this issue? Thanks