Hello can someone help me with this pice of code. I have app with custom tab bar image an now in iOS5 the image is gone. I know that they have made changes on tab bar implem
// Change the tab bar background
UIImage* tabBarBackground = [UIImage imageNamed:@"tabbar.png"];
[[UITabBar appearance] setBackgroundImage:tabBarBackground];
Use this code to detect iOS version
if ([[[UIDevice currentDevice] systemVersion] floatValue] < 5) {
[[tabBarController tabBar] insertSubview:viewa atIndex:0];
}else{
[[tabBarController tabBar] insertSubview:viewa atIndex:1];
}
Change source as below, you can fix this problem.
Old source:
[[tabBarController tabBar] insertSubview:viewa atIndex:0];
New source:
//1.Check version of iOS
if(iOSVersion <= 4.3){
[[tabBarController tabBar] insertSubview:viewa atIndex:0];
}else{
//iOS5
[[tabBarController tabBar] insertSubview:viewa atIndex:1];
}