En los ejemplos Manzanas del que recibes notificaciones a través del método delegado:
- (void)orientationChanged:(NSNotification *)notification
{
// We must add a delay here, otherwise we'll swap in the new view
// too quickly and we'll get an animation glitch
NSLog(@"orientationChanged");
[self performSelector:@selector(updateLandscapeView) withObject:nil afterDelay:0];
}
Y a continuación, para mostrar una pantalla vertical:
- (void)updateLandscapeView
{
PortraitView *portraitView = [[PortraitView alloc] init];
portraitView.delegate = self;
UIDeviceOrientation deviceOrientation = [UIDevice currentDevice].orientation;
if (UIDeviceOrientationIsLandscape(deviceOrientation) && !isShowingLandscapeView)
{
[self presentModalViewController: portraitView animated:YES];
isShowingLandscapeView = YES;
}
else if (deviceOrientation == UIDeviceOrientationPortrait && isShowingLandscapeView)
{
[self dismissModalViewControllerAnimated:YES];
isShowingLandscapeView = NO;
}
[portraitView release];
}
Por supuesto, usted tiene que diseñar el PortraitView como clase delegado para que esto funcione Como era la intención.
No es la única manera pero me parece que funciona bien y está en ejemplos de manzanas. Sin embargo, no lo haría en el Appdelegate, sino en tu escritorio, aunque no sé tu diseño.
por favor vea mi nueva respuesta Le explicaré el nuevo problema que tengo con su solución – ludo