The iPhone implements the UITabBarItem program code

Try as best I could, I can't seem to get this to work. Here's my final try. Can someone please tell me why this is not working?

In the method that is called by the initialization method of the my view controller:

UIImage *image = [UIImage imageNamed: @"window22.png"];
UITabBarItem *item = [[UITabBarItem alloc] initWithTitle: @"Some Title" image: image tag: 0];
self.tabBarItem = item;

      

All it does is a large square on which the image should be. The title on the tab bar remains the same as the title of the view controller.

Everything is programmed here programmatically, including the tab bar controller.

+2


a source to share


1 answer


According to the docs , the tabBarItem will be auto-generated - you don't need to create it yourself. When I set the title and image to the tabBar for the view controller, I used



self.tabBarItem.image = [UIImage imageNamed:imageName];

      

+1


a source







All Articles