// // CustomTabbarController.m // Lighting // // Created by 曹云霄 on 16/4/27. // Copyright © 2016年 上海勾芒科技有限公司. All rights reserved. // #import "CustomTabbarController.h" #import "Toolview.h" @interface CustomTabbarController () @property (nonatomic,strong) NSArray *identifierArray; @property (nonatomic,strong) NSArray *controllerArray; @end @implementation CustomTabbarController /** * UIStoryboard Identifier数组 * * @return NSArary */ - (NSArray *)identifierArray { if (_identifierArray == nil) { _identifierArray = [NSArray arrayWithObjects:@"shopping",@"Client", nil]; } return _identifierArray ; } - (NSArray *)controllerArray { if (_controllerArray == nil) { _controllerArray = [NSArray arrayWithObjects:@"ShoppingViewController",@"ClientViewController", nil]; } return _controllerArray; } - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. [self uiConfigAction]; [self addViewcontroller]; } #pragma mark -UI - (void)uiConfigAction { self.tabBar.frame = CGRectMake(Zero, Zero, ScreenWidth, NavigationHeight); Toolview *toolview = [[Toolview alloc]initWithFrame:CGRectMake(Zero, Zero, ScreenWidth, NavigationHeight)]; toolview.delegate = self; [self.tabBar addSubview:toolview]; } #pragma mark -添加controller - (void)addViewcontroller { UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"StoryboardwithCYX" bundle:nil]; ShoppingViewController *shoppingVC = [storyboard instantiateViewControllerWithIdentifier:[self.identifierArray firstObject]]; ClientViewController *clientVC = [storyboard instantiateViewControllerWithIdentifier:[self.identifierArray objectAtIndex_opple:1]]; NSArray *vcArray = [NSArray arrayWithObjects:clientVC,shoppingVC, nil]; self.viewControllers = vcArray; } #pragma amrk -TabbarButtonClickdelegate代理 - (void)ButtonClickAction:(NSInteger)Buttontag { if (Buttontag == 101) { self.selectedIndex = 0; }else if (Buttontag == 102){ self.selectedIndex = 1; } } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } /* #pragma mark - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller. } */ @end