如果是根據(jù)接口來的寂玲,那我的處理方法就是在首頁的viewWillAppear方法里加載接口悄但,動(dòng)態(tài)來移除或者不移除tabBarController里面的VC
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
// 控制質(zhì)損模塊是否隱藏
NSMutableDictionary *dic = [NSMutableDictionary dictionary];
[DCServiceTool postWithUrl:getLossState params:dic success:^(id responseObject) {
if ([responseObject[@"code"] integerValue] != 0) {
return;
}else{//responseObject[@"record"][@"flag"]
if (responseObject[@"record"][@"flag"]) {//顯示
}else {//隱藏
DCTabBarViewController *tabBarController = (DCTabBarViewController *)[UIApplication sharedApplication].delegate.window.rootViewController;
NSMutableArray *tabbarViewControllers = [NSMutableArray arrayWithArray: [tabBarController viewControllers]];
[tabbarViewControllers removeObjectAtIndex:2];
[tabBarController setViewControllers: tabbarViewControllers ];
}
}
} failure:^(NSError *error) {
}];
}