Reputation:
I'm loading up all the tab bar images and the images load on the simulator but the first tab bar item image doesn't load on device.
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];
[item0 setTitle:@"icon1"];
[item1 setTitle:@"icon2"];
[item2 setTitle:@"icon3"];
[item3 setTitle:@"icon4"];
[item0 setFinishedSelectedImage:[UIImage imageNamed:@"icon1.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"icon1"]];
[item1 setFinishedSelectedImage:[UIImage imageNamed:@"CalendarIconSelected"] withFinishedUnselectedImage:[UIImage imageNamed:@"CalendarIconSelected"]];
[item2 setFinishedSelectedImage:[UIImage imageNamed:@"News"] withFinishedUnselectedImage:[UIImage imageNamed:@"News"]];
[item3 setFinishedSelectedImage:[UIImage imageNamed:@"Events"] withFinishedUnselectedImage:[UIImage imageNamed:@"Events"]];
[item1 imageInsets];
[item2 imageInsets];
[item3 imageInsets];
Upvotes: 0
Views: 236
Reputation: 18875
Quite common scenario is mistyped filename. For some reason simulator is not case-sensitive with image files. Device on the other hand is.
So check and double-check each character in filename. Is it Icon1.png or icon1.PNG.
Upvotes: 1