iphone ios uiviewcontroller uitabbarcontroller device-orientation

iphone - Barra tabular de superposición con una vista



ios uiviewcontroller (3)

Esto funcionó para mí

- (void)viewDidLoad { [super viewDidLoad]; previousRect = self.view.frame; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration; { if(toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || toInterfaceOrientation == UIInterfaceOrientationLandscapeRight) { [self.navigationController setNavigationBarHidden:TRUE animated:FALSE]; [[UIApplication sharedApplication] setStatusBarHidden:TRUE animated:FALSE]; } else { [self.navigationController setNavigationBarHidden:FALSE animated:FALSE]; [[UIApplication sharedApplication] setStatusBarHidden:FALSE animated:FALSE]; } } -(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { UIInterfaceOrientation toOrientation = self.interfaceOrientation; if ( self.tabBarController.view.subviews.count >= 2 ) { UIView *transView = [self.tabBarController.view.subviews objectAtIndex:0]; UIView *tabBar = [self.tabBarController.view.subviews objectAtIndex:1]; if(toOrientation == UIInterfaceOrientationLandscapeLeft || toOrientation == UIInterfaceOrientationLandscapeRight) { transView.frame = CGRectMake(0, 0, 480, 320 ); tabBar.hidden = TRUE; } else { transView.frame = previousRect; tabBar.hidden = FALSE; } } }

Tengo un UIViewController dentro de la barra de pestañas. Para un VC en la barra de pestañas, permito que la interfaz gire al girar el dispositivo. El desafío es que quiero ocultar la barra de pestañas y cambiar el tamaño de mi vista en el interior.

Lo que hice:

1) called - (void)willAnimateRotation.... en el controlador de la barra de pestañas y establezco self.tabBar.isHidden en true -> desapareció la barra de pestañas.

2) llamado - (void)willAnimateRotation.... y establecer self.mapView.frame a la altura máxima.

PERO ... Todavía tengo una franja negra en la parte inferior de la pantalla en el tamaño exacto de la barra de pestañas. ¿Hay alguna manera de hacer que la barra de pestañas desaparezca por completo?


[self hideTabBar:self.tabBarController]; - (void) hideTabBar:(UITabBarController *) tabbarcontroller { [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:0.5]; for(UIView *view in tabbarcontroller.view.subviews) { if([view isKindOfClass:[UITabBar class]]) { [view setFrame:CGRectMake(view.frame.origin.x, 480, view.frame.size.width, view.frame.size.height)]; } else { [view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, 480)]; } } [UIView commitAnimations]; }


Si desea ocultar siempre la barra de pestañas cuando se presiona un UIViewController particular, puede hacer:

self.hidesBottomBarWhenPushed = YES;