La barra de estado se superpone al usar ECSlidingViewController
Frecuentes
Visto 1,786 veces
1
Agregué el siguiente código en la función implementadora AppDelegate didFinishLaunchingWithOptions
if ([[[UIDevice dispositivo actual] systemVersion] floatValue] >= 7) {
[application setStatusBarStyle:UIStatusBarStyleLightContent];
self.window.clipsToBounds =YES;
self.window.frame = CGRectMake(0,20,self.window.frame.size.width,self.window.frame.size.height-20);
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(applicationDidChangeStatusBarOrientation:)
name:UIApplicationDidChangeStatusBarOrientationNotification
object:nil];
}
así como esta función que se está llamando:
- (void)applicationDidChangeStatusBarOrientation:(NSNotification *)notification
{
int a = [[notification.userInfo objectForKey: UIApplicationStatusBarOrientationUserInfoKey] intValue];
int w = [[UIScreen mainScreen] bounds].size.width;
int h = [[UIScreen mainScreen] bounds].size.height;
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
UIDeviceOrientation orientationa = [[UIDevice currentDevice] orientation];
if (orientation==4)
{
self.window.frame = CGRectMake(20,0,w-20,h+20);
}else if(orientation==1)
{
self.window.frame = CGRectMake(0,20,w,h);
}else
{
self.window.frame = CGRectMake(-20,0,w+20,h+20);
}
}
Esto funciona para que la barra de estado no se superponga incluso cuando se gira, pero al hacer clic en un botón que realiza una solicitud al backend, cambia y se superpone hasta que se gira de nuevo, ¿alguien sabe por qué podría suceder esto? ¿Sospecho que podría tener algo que ver con ECSlidingViewController?
2 Respuestas
1
Pruebe este código y configúrelo en Info.plist Ver la apariencia de la barra de estado basada en el controlador = NO
- (void) viewDidLoad
{
[super viewDidLoad];
float systemVersion = [[[UIDevice currentDevice] systemVersion] floatValue];
if (systemVersion >= 7.0f)
{
CGRect tempRect;
for (UIView *sub in [[self view] subviews])
{
tempRect = [sub frame];
tempRect.origin.y += 20.0f; //Height of status bar
[sub setFrame:tempRect];
}
}
}
respondido 27 nov., 13:08
0
Para admitir ios7 con ECECSlidingViewController siempre que esté usando un controlador de navegación, desmarque todas las opciones para extender los bordes del controlador de vista XIB y, cuando no esté usando el controlador de navegación, puede usar el siguiente código en el archivo Viewcontroller.m.
-(void)viewDidLayoutSubviews
{
if([[[UIdevice currentdevice]systemversion]floatvalue] >=7.0f){
CGRect screen = [UIScreen mainscreen]bounds];
CGRect frame = self.view.frame;
frame.origin.y = 20.0f;
frame.size.height = screen.size.height - 20;
}
[self.view layoutsubviews];
}
y en vista terminó de lanzar agregar lo siguiente
[application setStatusbarStyle:UIStatusBarStyleTranslucent];
y en el archivo plist agregue ViewControllerBasedStatuschangedAppearence a NO
respondido 27 nov., 13:07
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas ios ios7 ecslidingviewcontroller or haz tu propia pregunta.
stackoverflow.com/questions/17074365/… - the1pawan
referir esto stackoverflow.com/a/20093515/1545180 y este stackoverflow.com/a/19025547/1545180 - Ganapathy