Все еще возникают проблемы с отправкой нового UIView при повороте. Я следую примеру, который я нашел. Это НАСТОЛЬКО чертовски близко. В этот момент он выходит с ошибкой с ошибкой;
«NSInvalidArgumentException», причина: «Приложение пыталось представить нулевой контроллер модального представления на цели».
controller nvs = [self.storyboard instantiateViewControllerWithIdentifier:@"LandscapeView"];
[self.navigationController pushViewController:nvs animated:YES]
Ясно, что я что-то здесь упускаю. То, что я пытаюсь добиться, - это другое представление, помещаемое в стек, когда пользователь поворачивает свое устройство. Как календарь.
Полное заявление
LandscapeViewController * nvs;
- (void) updateLandscapeView { UIDeviceOrientation deviceOrientation = [UIDevice currentDevice].orientation;
if (UIDeviceOrientationIsLandscape(deviceOrientation) && self.presentedViewController == nil)
{
if (!self.landscapeViewController)
//self.landscapeViewController = [[LandscapeViewController alloc] initWithNibName:@"LandscapeView" bundle:nil];
//Set the location of the where you want the view to go i.e. the next view controller
nvs = [self.storyboard instantiateViewControllerWithIdentifier:@"LandscapeView"];
//Push the view onto the device
[self.navigationController pushViewController:nvs animated:YES];
if ([self respondsToSelector:@selector(presentViewController:animated:completion:)])
[self presentViewController:self.landscapeViewController animated:YES completion:NULL];
else
[self presentModalViewController:self.landscapeViewController animated:YES];
}
else if (deviceOrientation == UIDeviceOrientationPortrait && self.presentedViewController != nil)
{
if ([self respondsToSelector:@selector(dismissViewControllerAnimated:completion:)])
[self dismissViewControllerAnimated:YES completion:NULL];
else
[self dismissModalViewControllerAnimated:YES];
}
}
Заранее спасибо! Джереми