我做了一个选项卡iOS项目,当我收到要求将选项卡背景图更改为自定义图像的请求时。该项目是针对iOS 4.x开发的,因此iOS5的
[tabBar setTabBarBackgroundImage:[UIImage imageNamed:@"custom.jpg"]]
无法工作。你能给我一些简单的解决方案吗?(如果可能的话,我不想改变整个项目)。
编辑:
只需要三行代码即可解决所有问题:UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"customImage.png"]];
[self.tabBarController.tabBar insertSubview:imageView atIndex:0];
[imageView release];