Reputation: 2317
There is something with my ViewControllers' hierarchy that I don't get. Please take a look at my Storyboard:
What I'm trying to do, is programmatically setting the TabBarItem image associated with the NavigationController in the center of the Bottom Row. I want to do that with a button on the ViewController at Bottom Right.
I tried several things, like
self.navigationController.tabBarItem.image = someValidImage;
and
UITabBarItem *myIcon =[self.navigationController.tabBarController.tabBar.items objectAtIndex:2];
myIcon.image = someValidImage;
but to no avail.
I'm sure it is something obvious, but I'm staring at this quite a while now. Could any of you help me out here?
Upvotes: 0
Views: 38
Reputation: 76
Please try this here we set two types of image one for selected-state other one for unselected state hope this will help you!!..
here "xyz" will be your image name.
[[tabBarController_obj.viewControllers objectAtIndex:0] tabBarItem]setFinishedSelectedImage:[UIImage imageNamed:@"xyz.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"xyz.png"]];
try this for all tabs in ur case , I think u have to do three time.
Upvotes: 1