poner para oculto ocultar gratis fotos contraseña con como clave app album iphone ios objective-c uitabbarcontroller

para - como poner clave a un album de fotos en iphone



Iphone: ¿Es posible esconder el TabBar?(Pre-iOS 8) (16)

¿Por qué no estás usando un controlador de navegación? Es mucho más fácil ocultar la barra de navegación que la barra de pestañas ...

Tengo una aplicación que usa un UITabBarController para cambiar de modo. Cuando estoy en un cierto modo, me gustaría ocultar la barra de pestañas hasta que se hayan completado los pasos de ese modo. Tenga en cuenta que no estoy usando un controlador de navegación, así que no puedo usar el método setHidesBottomBarWhenPushed en el controlador de navegación para ocultar la barra de pestañas.

Antes de iOS 8, cuando intento ocultar el tarbar usando:

self.tabBarController.tabBar.hidden = YES

la barra de pestañas se va, pero deja un área en blanco de 50 píxeles en la parte inferior de la pantalla donde solía estar la barra de pestañas. Parece que no puedo entender cómo llenar esa área. Cualquier cosa en la interfaz de usuario que se encuentre en esa área está recortada y no se puede ver.

Alguna idea si esto es posible? Realmente me gustaría mantenerme alejado del controlador de navegación.


¿Tiene el autoResizingMask establecido en la vista secundaria?

view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

Algo así debería ser el truco y permitir que la vista se sienta encima de la pila para volver a clasificar según el tamaño.


Acabo de hacer el siguiente código en Monotouch dentro de una subclase de UITabBarController:

public void ShowTabBar() { UIView.BeginAnimations("Anim"); UIView.SetAnimationDuration(0.25f); this.View.Subviews[0].Frame = new RectangleF(0f, 0f, 320f, 431f); this.TabBar.Frame = new RectangleF(0f, 431f, 320f, 49f); this.TabBar.Hidden = false; UIView.CommitAnimations(); } public void HideTabBar() { UIView.BeginAnimations("Anim"); UIView.SetAnimationDuration(0.25f); this.View.Subviews[0].Frame = new RectangleF(0f, 0f, 320f, 480f); this.TabBar.Frame = new RectangleF(0f, 481f, 320f, 510f); this.TabBar.Hidden = true; UIView.CommitAnimations(); }


Al igual que Steve, no he encontrado una manera clara de hacerlo (aunque Apple Photopicker hace algo similar). Esto es lo que hice:

if (systemAction) { // Reveal tab bar back CGRect bounds = [[UIScreen mainScreen] bounds]; CGRect tabBarFrame = self.tabBarController.tabBar.frame; self.tabBarController.view.frame = CGRectMake(0,0,bounds.size.width,bounds.size.height); self.toolBar.hidden = YES; systemAction = NO; } else { //hide tab bar CGRect bounds = [[UIScreen mainScreen] bounds]; CGRect tabBarFrame = self.tabBarController.tabBar.frame; CGRect navigationBarFrame = self.navigationController.navigationBar.frame; self.tabBarController.view.frame = CGRectMake(0,0,bounds.size.width,bounds.size.height+tabBarFrame.size.height); self.toolBar.hidden = NO; CGRect frame = self.toolBar.frame; frame.origin.y = bounds.size.height - frame.size.height - navigationBarFrame.size.height; self.toolBar.frame = frame; systemAction = YES; }

Lo que hace es presionar la vista para que pueda mostrar una barra de herramientas (y no ocultarla). Obviamente esto es solo para la ''vista raíz'' de un tabbar + controlador de navegación. Para cualquier vista posterior, puede establecer ''hiddenBottomBarWhenPushed'' en el controlador de vista que está presionando.


Aquí está mi código para eso:

Esto es, por supuesto, desorbitado con lo que está sucediendo en la jerarquía de vista del controlador. Podría cambiar / romperse. Esto utiliza API definidas, por lo que a Apple no le importará, pero tampoco les importará romper tu código.

- (void)hideTabBar { UITabBar *tabBar = self.tabBarController.tabBar; UIView *parent = tabBar.superview; // UILayoutContainerView UIView *content = [parent.subviews objectAtIndex:0]; // UITransitionView UIView *window = parent.superview; [UIView animateWithDuration:0.5 animations:^{ CGRect tabFrame = tabBar.frame; tabFrame.origin.y = CGRectGetMaxY(window.bounds); tabBar.frame = tabFrame; content.frame = window.bounds; }]; // 1 } - (void)showTabBar { UITabBar *tabBar = self.tabBarController.tabBar; UIView *parent = tabBar.superview; // UILayoutContainerView UIView *content = [parent.subviews objectAtIndex:0]; // UITransitionView UIView *window = parent.superview; [UIView animateWithDuration:0.5 animations:^{ CGRect tabFrame = tabBar.frame; tabFrame.origin.y = CGRectGetMaxY(window.bounds) - CGRectGetHeight(tabBar.frame); tabBar.frame = tabFrame; CGRect contentFrame = content.frame; contentFrame.size.height -= tabFrame.size.height; }]; // 2 }

Editar : un usuario anónimo ha sugerido la siguiente adición para 7.0 (no he probado esto, y no podría decir si es una solución o una implementación ideal):

// 1. To Hide the black line in IOS7 only, this extra bit is required if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")) { [self.tabBarController.tabBar setTranslucent:YES]; } // 2. For IOS 7 only if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")) { [self.tabBarController.tabBar setTranslucent:NO]; }

Editar : Totalmente no probado en 8.x y probablemente carezca de algunos diseños.


Aquí está mi solución (mi controlador de vista de pestañas está dentro del controlador de navegación para una buena medida) ... Así que he sublimado UITabBarController e hice esto ... exponiendo -setTabBarHidden: method

- (void)setTabBarHidden:(BOOL)hidden { _tabBarHidden = hidden; [UIView performWithoutAnimation:^{ [self adjustViews]; }]; } - (void)adjustViews { if ( _tabBarHidden ) { CGRect f = self.tabBar.frame; // move tab bar offscreen f.origin.y = CGRectGetMaxY(self.view.frame); self.tabBar.frame = f; // adjust current view frame self.selectedViewController.view.frame = self.view.frame; } else { CGRect f = self.tabBar.frame; // move tab bar on screen f.origin.y = CGRectGetMaxY(self.view.frame) - (CGRectGetMaxY(self.tabBar.bounds) + CGRectGetMaxY(self.navigationController.navigationBar.frame)); self.tabBar.frame = f; // adjust current view frame f = self.view.bounds; f.size.height -= CGRectGetMaxY(self.tabBar.bounds); self.selectedViewController.view.frame = f; } } - (void)viewWillLayoutSubviews { [super viewWillLayoutSubviews]; [UIView performWithoutAnimation:^{ [self adjustViews]; }]; } - (void)viewDidLayoutSubviews { [super viewDidLayoutSubviews]; [UIView performWithoutAnimation:^{ [self adjustViews]; }]; }


Aumentando la máscara tiene una enumeración. Intenta establecer todas las opciones y comprueba si la opción de autoevaluación de las subvistas está marcada en la vista principal


Es un poco tarde en el día, pero de todas las respuestas a la pregunta que he analizado esta tarde, esta es la que mejor funcionó para mí.

Cómo ocultar uitabbarcontroller

// Method call [self hideTabBar:self.tabBarController];

// Method implementations - (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]; } - (void)showTabBar:(UITabBarController *) tabbarcontroller { [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:0.5]; for(UIView *view in tabbarcontroller.view.subviews) { NSLog(@"%@", view); if([view isKindOfClass:[UITabBar class]]) { [view setFrame:CGRectMake(view.frame.origin.x, 431, view.frame.size.width, view.frame.size.height)]; } else { [view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, 431)]; } } [UIView commitAnimations]; }


Espero que esto funcione.

@interface UITabBarController (Additions) -(void)setTabBarHidden:(BOOL)hidden animated:(BOOL)animated; @end @implementation UITabBarController (Additions) -(void)setTabBarHidden:(BOOL)hidden animated:(BOOL)animated { if (animated) { [UIView beginAnimations:nil context:nil]; } if (hidden) { self.tabBar.frame = CGRectMake(self.tabBar.frame.origin.x, self.tabBar.superview.frame.size.height, self.tabBar.bounds.size.width, self.tabBar.bounds.size.height); } else { self.tabBar.frame = CGRectMake(self.tabBar.frame.origin.x, self.tabBar.superview.frame.size.height - self.tabBar.frame.size.height + 10, self.tabBar.bounds.size.width, self.tabBar.bounds.size.height); } if (animated) { [UIView commitAnimations]; } }


Había trabajado en casi el mismo caso, de hecho usé el código de http://www.developers-life.com/hide-uitabbarcontrolleruitabbar-with-animation.html y lo hice mejor según mis necesidades, esto también podría ayudar a otros.

Estoy usando un UISplitViewController como el controlador de vista raíz y su porción de detalles es un UITabBarController, tuve que ocultar la barra de pestañas en modo vertical:

// In UITabBarController''s custom implementation add following method, // this method is all that will do the trick, just call this method // whenever tabbar needs to be hidden/shown - (void) hidetabbar:(NSNumber*)isHidden { UITabBarController *tabBarController=self; [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:0.5]; CGRect tabbarFrame=CGRectZero; for(UIView *theView in tabBarController.view.subviews) { //NSLog(@"%@", view); if([theView isKindOfClass:[UITabBar class]]) { tabbarFrame=theView.frame; if ([isHidden boolValue]) { tabbarFrame=CGRectMake(tabbarFrame.origin.x, tabBarController.view.frame.size.height, tabbarFrame.size.width, tabbarFrame.size.height); } else { tabbarFrame=CGRectMake(tabbarFrame.origin.x, tabBarController.view.frame.size.height - tabbarFrame.size.height, tabbarFrame.size.width, tabbarFrame.size.height); } theView.frame=tabbarFrame; break; } } for(UIView *theView in tabBarController.view.subviews) { if(![theView isKindOfClass:[UITabBar class]]) { CGRect theViewFrame=theView.frame; if ([isHidden boolValue]) { theViewFrame=CGRectMake(theViewFrame.origin.x, theViewFrame.origin.y, theViewFrame.size.width, theViewFrame.size.height + tabbarFrame.size.height); } else { theViewFrame=CGRectMake(theViewFrame.origin.x, theViewFrame.origin.y, theViewFrame.size.width, theViewFrame.size.height - tabbarFrame.size.height); } theView.frame=theViewFrame; } } [UIView commitAnimations]; }

Usé el siguiente código para llamar al método hidetabbar:

//In my UISplitViewController''s custom implementation - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { @synchronized(self){ //change the self.splitDetailController to your UITabBarController''s object [self.splitDetailController performSelector:@selector(hidetabbar:) withObject:[NSNumber numberWithBool:UIInterfaceOrientationIsLandscape(interfaceOrientation)] afterDelay:0.5]; } return YES; }

Probé este código para que funcione solo en el simulador, avíseme si también funciona en el dispositivo ;-)


Intenté varias de las soluciones anteriores, pero no me gustó iOS 8. Encuentro que la configuración en vista me parecerá lo siguiente. Debería funcionar en iOS 7 cuando se introdujo extendedLayoutIncludesOpaqueBars.

self.extendedLayoutIncludesOpaqueBars = true self.tabBarController?.tabBar.isHidden = true self.tabBarController?.tabBar.isOpaque = true

y si necesita volver a activar tabBars cuando salga, use lo siguiente en la vista de Desaparecer.

self.tabBarController?.tabBar.isHidden = false self.tabBarController?.tabBar.isOpaque = false

Lo uso para permitir un retorno de una transición para mantener oculto el TabBar . No lo usé en una acción de botón, pero si, al igual que yo, no encuentra nada arriba, ahora funciona, esta podría ser la base de una solución programable.


La solución obvia, mantener su arquitectura original, habría sido presentar esa vista modalmente:

- (void)tabBarController:(UITabBarController *)tb didSelectViewController:(UIViewController *)vc { if (tb.selectedIndex == MODALONE) { UIViewController* mod = [[UIViewController alloc] initWithNibName: @"ModalView" bundle: nil]; [tb presentModalViewController:mod animated:NO]; [mod release]; } }

La vista ahora cubre toda la pantalla (excepto la barra de estado, hay una) que incluye la barra de pestañas, por lo que parece que la barra de pestañas se ha salido en respuesta al usuario que presiona ese elemento de la barra de pestañas.


Puede crear la categoría de Tabbar y mostrar / Ocultar fácilmente. y puedes acceder a la vista completa.

crear la categoría #import "UITabBarController+HideTabBar.h"

@implementation UITabBarController (HideTabBar) - (void)hideTabBarAnimated:(BOOL)animated { CGRect statusbarFrame = [UIApplication sharedApplication].statusBarFrame; CGRect tabBarControllerFrame = self.view.frame; if (statusbarFrame.size.height>20) { tabBarControllerFrame.size.height = screenSize.size.height + self.tabBar.frame.size.height - 20.0; } else { tabBarControllerFrame.size.height = screenSize.size.height + self.tabBar.frame.size.height ; } if (animated) { [UIView animateWithDuration:0.2 animations:^{ [self.view setFrame:tabBarControllerFrame]; } completion:^(BOOL finished) { }]; } else [self.view setFrame:tabBarControllerFrame]; } - (void)showTabBarAnimated:(BOOL)animated { CGRect statusbarFrame = [UIApplication sharedApplication].statusBarFrame; CGRect tabBarControllerFrame = self.view.frame; if (statusbarFrame.size.height>20) { tabBarControllerFrame.size.height = screenSize.size.height - 20.0; } else { tabBarControllerFrame.size.height = screenSize.size.height ; } if (animated) { [UIView animateWithDuration:0.2 animations:^{ [self.view setFrame:tabBarControllerFrame]; } completion:^(BOOL finished) { }]; } else [self.view setFrame:tabBarControllerFrame]; } @end

Nota : use statusbarFrame se usa cuando el punto de acceso o la llamada están en ON para que la barra de tabulación no recorte.

Ahora importa la categoría en la cual tu clase quieres usar métodos y simplemente llama a los métodos a continuación para ocultar o mostrar tabbar.

[self.tabBarController hideTabBarAnimated:YES]; [self.tabBarController showTabBarAnimated:YES];

Espero que esto ayude.


Uso solo esta línea para lograr esto. Utilizo el método prepareForSegue antes de mostrar el controlador de vista que tiene la barra de pestañas.

-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{ if([segue.identifier isEqualToString:@"showLogin"]){ [segue.destinationViewController setHidesBottomBarWhenPushed:YES]; } }



poner la declaración en el método init del UIViewController

override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) self.hidesBottomBarWhenPushed = true setupDependencyConfigurator() }