在原生基础上自定义TabBar

//假的页面 用来弹出 页面
UIViewController * viewCtrl = [[UIViewController alloc]init];
viewCtrl.tabBarItem.imageInsets = UIEdgeInsetsMake(6, 0, -6, 0);
viewCtrl.tabBarItem.image = [[UIImage imageNamed:_defaultImage[2]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];

[self setViewControllers:@[homeNavigationCtrl,commnityNavigationCtrl,viewCtrl,mallNavigationCtrl,mineNavigationCtrl]];



UIButton * addButton =  [[UIButton alloc]initWithFrame:CGRectMake(kTabBarButton_Width * 2, 0,kTabBarButton_Width, 40)];
[addButton setTitle:nil forState:UIControlStateNormal];
[addButton addTarget:self action:@selector(addTabBarButtonOnClick) forControlEvents:UIControlEventTouchDown];

[self.tabBar addSubview:addButton];


commnityViewCtrl.tabBarItem.selectedImage = [[UIImage imageNamed:_defaultImage[1]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];

你可能感兴趣的:(在原生基础上自定义TabBar)