I have a memory leak situation about UITabBarItem. My app has a TabBarController with customized pictures. so here is the code I put on my graph files.
UIImage *selectedImage0 = [UIImage imageNamed:@"A-click.png"];
UIImage *unselectedImage0 = [UIImage imageNamed:@"A.png"];
UIImage *selectedImage1 = [UIImage imageNamed:@"B-click.png"];
UIImage *unselectedImage1 = [UIImage imageNamed:@"B.png"];
UITabBar *tabBar = self.mytabbarcontroller.tabBar;
UITabBarItem *item0 = [tabBar.items objectAtIndex:0];
UITabBarItem *item1 = [tabBar.items objectAtIndex:1];
[item0 setFinishedSelectedImage:selectedImage0 withFinishedUnselectedImage:unselectedImage0];
[item1 setFinishedSelectedImage:selectedImage1 withFinishedUnselectedImage:unselectedImage1];
And it works totally well !!! However, when I use Instruments tool to check memory leak, it shows there is leak from
[item0 setFinishedSelectedImage:selectedImage0 withFinishedUnselectedImage:unselectedImage0];
[item1 setFinishedSelectedImage:selectedImage1 withFinishedUnselectedImage:unselectedImage1];
If I comment these two lines without using setFinishedSelectedImage, there won't be leak. I feel it is weird and doesn't make sense for me. Already searched the document and reference and couldn't find relative information. I am using iOS 6 and Xcode 4.5 . Do anyone knows about this? thanks in advance.