如何将图像背景设置为 UITabBarController iOS 5 [英] How to set image background to UITabBarController iOS 5

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

问题描述

您好,有人可以帮我处理这段代码吗?我有带有自定义标签栏图像的应用程序,现在在 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]; 
}

感谢您的帮助

推荐答案

使用此代码检测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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆