對于這個控件的隱藏,我也很蛋疼.建議如果小伙伴不熟悉這個的自定義,用系統提供的就可以,方便很多,除非項目的需求不得不讓你用自定義.
一般有兩種
1.第一種,隱藏后tabBar原來的位置可能會出現空白
//1.設置self.tabBarController.tabBar.hidden=YES;
self.tabBarController.tabBar.hidden=YES;
2.第二種,在需要的頁面跳轉隱藏,建議使用這種
//2.如果在push跳轉時需要隱藏tabBar,設置self.hidesBottomBarWhenPushed=YES;
self.hidesBottomBarWhenPushed=YES;
NextViewController *next=[[NextViewController alloc]init];
[self.navigationController pushViewController:next animated:YES];
self.hidesBottomBarWhenPushed=NO;
//并在push后設置self.hidesBottomBarWhenPushed=NO;
//這樣back回來的時候,tabBar會恢復正常顯示。