1. Hide Tabbar:
[CPP]View PlainCopy
- -(void) Hidetabbar {
- if (Self.tabBarController.tabBar.hidden = = YES) {
- return;
- }
- UIView *contentview;
- if ([[[Self.tabBarController.view.subviews objectatindex:0] Iskindofclass:[uitabbar class])
- Contentview = [Self.tabBarController.view.subviews objectatindex:1];
- Else
- Contentview = [Self.tabBarController.view.subviews objectatindex:0];
- Contentview.frame = CGRectMake (contentview.bounds.origin.x, CONTENTVIEW.BOUNDS.ORIGIN.Y, ContentView.bounds.size.width, ContentView.bounds.size.height + self.tabBarController.tabBar.frame.size.height);
- Self.tabBarController.tabBar.hidden = YES;
- }
2. Display Tabbar:
[CPP]View PlainCopy
- -(void) Showtabbar
- {
- if (Self.tabBarController.tabBar.hidden = = NO)
- {
- return;
- }
- UIView *contentview;
- if ([[[Self.tabBarController.view.subviews objectatindex:0] Iskindofclass:[uitabbar class])
- Contentview = [Self.tabBarController.view.subviews objectatindex:1];
- Else
- Contentview = [Self.tabBarController.view.subviews objectatindex:0];
- Contentview.frame = CGRectMake (contentview.bounds.origin.x, CONTENTVIEW.BOUNDS.ORIGIN.Y, ContentView.bounds.size.width, Contentview.bounds.size.height-self.tabbarcontroller.tabbar.frame.size.height);
- Self.tabBarController.tabBar.hidden = NO;
- }
3. If the above two methods are defined, the Viewdidappear: method can call the
[CPP]View PlainCopy
- -(void) Viewdidappear: (BOOL) animated{
- //[self Hidetabbar];
- [Self showtabbar];
- }
ios--ways to hide and show Tabbar