i want to make a custom tabbar for my apps, and i already try to put my code in the first viewcontroller and it works!.
but here’s the problem, i want to declare and put my code in Appdelegate.m, but when i run it, it only shows me a black tabbar controller with no image.
for your info, i embeding my tabbar controller from storyboard.
here’s the code
UIImage *selectedImage0 = [UIImage imageNamed:@"img1.png"];
UIImage *unselectedImage0 = [UIImage imageNamed:@"img1hov.png"];
UIImage *selectedImage1 = [UIImage imageNamed:@"img2.png"];
UIImage *unselectedImage1 = [UIImage imageNamed:@"img2hov.png"];
UIImage *selectedImage2 = [UIImage imageNamed:@"img3.png"];
UIImage *unselectedImage2 = [UIImage imageNamed:@"img3hov.png"];
UIImage *selectedImage3 = [UIImage imageNamed:@"img4.png"];
UIImage *unselectedImage3 = [UIImage imageNamed:@"img4hov.png"];
UIImage *selectedImage4 = [UIImage imageNamed:@"img5.png"];
UIImage *unselectedImage4 = [UIImage imageNamed:@"img5hov.png"];
UITabBar *tabBar = self.tabBarController.tabBar;
UITabBarItem *item0 = [tabBar.items objectAtIndex:0];
UITabBarItem *item1 = [tabBar.items objectAtIndex:1];
UITabBarItem *item2 = [tabBar.items objectAtIndex:2];
UITabBarItem *item3 = [tabBar.items objectAtIndex:3];
UITabBarItem *item4 = [tabBar.items objectAtIndex:4];
tabBar.backgroundImage = [UIImage imageNamed:@"back_menu.png"];
[item0 setFinishedSelectedImage:selectedImage0 withFinishedUnselectedImage:unselectedImage0];
[item1 setFinishedSelectedImage:selectedImage1 withFinishedUnselectedImage:unselectedImage1];
[item2 setFinishedSelectedImage:selectedImage2 withFinishedUnselectedImage:unselectedImage2];
[item3 setFinishedSelectedImage:selectedImage3 withFinishedUnselectedImage:unselectedImage3];
[item4 setFinishedSelectedImage:selectedImage4 withFinishedUnselectedImage:unselectedImage4];
Go through following link,
1) http://idevrecipes.com/2011/01/04/how-does-the-twitter-iphone-app-implement-a-custom-tab-bar/
2)http://www.simplecode.me/2011/12/05/tab-based-ios-apps-uitabbarcontroller/
3)http://sugartin.info/2011/07/01/customizing-tab-bar/
4)http://code4app.net/ios/TabBar-with-Expands/5004e0206803fa546a000001
5)http://www.guerrillawebsitedesign.co.uk/wordpress/index.php/2010/09/30/how-to-create-a-custom-uitabbarcontroller-for-the-iphone-with-different-background-images-and-icons-part-1-2/