I read various answers about adding tabbed icons in both the application delegate and the interface builder. I want to add them to my firtsviewcontroller because I wanted to read the name of the icon image with a plist . It is proposed to do the following:
NSArray *viewControllerArray = nil; viewController1 = <View Init Code> viewController2 = <View Init Code> viewController3 = <View Init Code> 1stNavController = [[UINavigationController alloc] initWithRootViewController:viewController1]; UIImage *img = [UIImage imageNamed:@"tab_home"]; [1stNavController .tabBarItem initWithTitle:@"Home" image:img tag:1];
But I do not like to do it this way, because I think it is not clean. I would like to do something similar to the following, but I do not know why it does not work:
[[self.tabBarController.tabBar.items objectAtIndex:2] setIcon:[UIImage imageNamed:....]];
Any solution?
Aitul source share