0
votes

I'm currently in the process of building an app in XCode 4.6 with iOS 6 as the minimum target. As far as I'm aware this app should work in iOS7 devices, however the selected icon stays on my unselected icon when changing tabs. iOS6 devices work absolutely fine

    self.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"Home" image:[UIImage imageNamed:@"Tab_home.png"] tag:0];
    [[self tabBarItem] setFinishedSelectedImage:[UIImage imageNamed:@"Tab_homeselected"] withFinishedUnselectedImage:[UIImage imageNamed:@"Tab_home.png"]];

Now looking through Apple docs/Stackoverflow I've seen a few posts saying that these methods are deprecated in iOS7 which is fair enough. However I'm not using XCode 5 or building for iOS7. I'm building for iOS6 and as far as I'm aware Apple state that old apps should work.

Does anyone know how I can get around this? I've tried the suggestion here issue with ios7 tabbar controller

but I get build errors as UIImageRenderingModeAlwaysOriginal is not defined. Is it a case of somehow using respondsToSelector and performSelector for this to do something similar to

 [[UITabBarItem alloc] initWithTitle:@"Music" image:musicImage selectedImage:musicImageSel];

as outlined at UITabBar not showing selected item images in ios 7

1

1 Answers

0
votes

The build errors for UIImageRenderingModeAlwaysOrigina, is because it was only introduced in iOS SDK 7.0 so if you are building for iOS 6 you cannot use this as it is undefined (not included in SDK 6.x), If you are building solely for iOS 6 it will work on iOS 7 devices but you can only use code that is present in the iOS 6 SDK (which you are using). I wouldn't worry about Apple docs/Stackoverflow saying things are depreciated, you only need append your code if your compiler (Xcode) says it's depreciated for your deployment target (in your case 6.x).