本文介绍了如何图片背景设置的UITabBarController的iOS 5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好有人可以帮助我这个PICE code的。我的应用程序自定义标签栏图像的现iOS5中的图像消失。我知道,他们已经对标签栏实现更改,我不知道如何解决这个问题。

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 implementation and i'm not sure how to fix this.

- (void)applicationDidFinishLaunching:(UIApplication *)application {
[window makeKeyAndVisible];
CGRect frame = CGRectMake(0, 0, 400, 148);
UIView *viewa = [[UIView alloc] initWithFrame:frame];
UIImage *tabBarBackgroundImage = [UIImage imageNamed:@"fasha-down.png"];
UIColor *color = [[UIColor alloc] initWithPatternImage:tabBarBackgroundImage];


[viewa setBackgroundColor:color];
[[tabBarController tabBar] insertSubview:viewa atIndex:0];
[color release];
[viewa release];
[window addSubview:tabBarController.view]; 
}

感谢您的帮助。

推荐答案

使用此code检测的iOS版本

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];
}

这篇关于如何图片背景设置的UITabBarController的iOS 5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 04:49