CGRect frame = CGRectMake(0.0, 0.0, self.view.bounds.size.width, 48);
UIView *tabbarbackgroundview = [[UIView alloc] initWithFrame:frame];
[tabbarbackgroundview setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"tabbarbackground.png"]]];
[tabbarbackgroundview setAlpha:0.8];
[[self tabBar] addSubview:tabbarbackgroundview];
然后自己的每一个页面tabbar下面图片显示,在该页面(显示的页面)
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
UITabBarItem *item = [[UITabBarItem alloc]initWithTitle:@"动态密码" image:[UIImage imageNamed:@"logout-pg.png"] tag:1];
self.tabBarItem = item; //yi 在每个页面给tabbar添加itme
}
return self;
}