设置tabBar的背景图片的原理是在tabBar上添加UIImageView,并且点击不同的Index则切换不同的图片。
(1)新建文件RootViewController,继承于UITabBarController,并且设置委托UITabBarControllerDelegate;
(2)在AppDelegate.m中didFinishLaunchingWithOptions下添加代码如下:
RootViewController
*root = [[RootViewController
alloc
]
initWithNibName
:
nil
bundle
:
nil
];
self
.
window
.rootViewController
= root;
(3)RootViewController.h中:
@interface RootViewController : UITabBarController<</span>UITabBarControllerDelegate>
{
UIImageView *selectImage;
}
- (void)