The hidden tabbar--of iOS development resolves a problem where the corresponding location event is still not responding after hiding

Source: Internet
Author: User

Status Bar StatusBar
1     [UIApplication sharedapplication].statusbarhidden = YES;
Navigation bar Navigationbar
1     [Self.navigationcontroller Setnavigationbarhidden:yes];
Tabbar Method 1
1     [Self.tabBarController.tabBar Sethidden:yes];

There is a problem with this approach, although the Tabbar is hidden, but the area becomes blank and cannot be used by other views.

Method 2

For the structure of Navigationcontroller+tabbarcontroller, You can set the Hidesbottombarwhenpushed property of Childcontroller to Yes before you push the next level of Childcontroller.

For example, you can do this in the Childcontroller initialization method, with the following code:

1//The designated initializer.  Override If you create the controller programmatically and want to perform customization so is not appropriate for viewd Idload. 2  3-(ID) Initwithnibname: (NSString *) Nibnameornil Bundle: (NSBundle *) Nibbundleornil {4 Self     = [super Initwithnibname:nibnameornil Bundle:nibbundleornil];  5     if (self) {6         //Custom initialization. 7         self.hidesbottombarwhenpushed = YES; 8     } 9     return self;10 }
Method 3

Http://www.azumi.cc/thread-539502-1-1.html

 1-(void) Maketabbarhidden: (BOOL) Hide 2 {3 if ([Self.tabBarController.view.subviews count] < 2) 4 {5 Return 6} 7 UIView *contentview;         8 9 if ([[[Self.tabBarController.view.subviews objectatindex:0] Iskindofclass:[uitabbar class]) 10 {11 Contentview = [Self.tabBarController.view.subviews objectatindex:1];12}13 else14 {contentview = [Self.tabBarController.view.subviews objectatindex:0];16}17//[UIView beginanimations:@ "Tabbarhide" context:n        il];18 if (hide), {contentview.frame = Self.tabBarController.view.bounds;                                        }22 else23 {contentview.frame = CGRectMake (self.tabbarcontroller.view.bounds.origin.x,25 Self.tabbarcontroller.view.bounds.origin.y,26 self. tabbarcontroller.view.bounds.size.width,27 Self.tabBarController.view.bounds.size.height-self.tabbarcontroller.tabbar.frame.size.height)}29 Self.tabBarController.tabBar.hidden = Hide   ;//[UIView commitanimations]; 32}
Time
1-(void) Viewwillappear: (bool) Animated {2     [self setfullscreen:yes]; 3} 4  5-(void) Viewwilldisappear: (BOOL) Animated {6     [self setfullscreen:no]; 7} 8  9-(void) Setfullscreen: (BOOL) fullscreen {ten     //status bar     [ UIApplication Sharedapplication].statusbarhidden = fullscreen;12     //navigation bar     [Self.navigationcontroller setnavigationbarhidden:fullscreen];14     //Tabbar is implemented by setting the Hidesbottombarwhenpushed property in the initialization method. 15}

The hidden tabbar--of iOS development resolves a problem where the corresponding location event is still not responding after hiding

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.