Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/98.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone iOS-方向更改时更改视图_Iphone_Ios_Uiinterfaceorientation_Uistoryboardsegue - Fatal编程技术网

Iphone iOS-方向更改时更改视图

Iphone iOS-方向更改时更改视图,iphone,ios,uiinterfaceorientation,uistoryboardsegue,Iphone,Ios,Uiinterfaceorientation,Uistoryboardsegue,我将iOS5与故事板一起使用,创建了两个ViewController,一个用于纵向,另一个用于横向。。 我用两个模态segue连接了两个视图,这是我使用的代码: - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { UIDeviceOrientation deviceOrientation = [UIDevice currentDevice].orientatio

我将iOS5与故事板一起使用,创建了两个ViewController,一个用于纵向,另一个用于横向。。 我用两个模态segue连接了两个视图,这是我使用的代码:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
UIDeviceOrientation deviceOrientation = [UIDevice currentDevice].orientation;
if (UIDeviceOrientationIsLandscape(deviceOrientation))
{
    [self performSegueWithIdentifier: @"aaaa" sender: self];
}
else if (deviceOrientation == UIDeviceOrientationPortrait)
{
    [self performSegueWithIdentifier: @"ddd" sender: self];
}    

return true;

}
如果我从纵向改为横向,它可以工作,但当我返回纵向视图时,它崩溃了,没有标识符为“ddd”的序列,但它存在


谢谢。

我已决定在视图之间设置一个模式段,然后使用以下代码进入实现文件:

- (void)willAnimateRotationToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration
{
   if(self.interfaceOrientation == UIDeviceOrientationPortrait || self.interfaceOrientation == UIDeviceOrientationPortraitUpsideDown){

       [self performSegueWithIdentifier: @"aaaa" sender: self];

   } else  if(self.interfaceOrientation == UIDeviceOrientationLandscapeLeft || self.interfaceOrientation == UIDeviceOrientationLandscapeRight)
   {

       [self performSegueWithIdentifier: @"ddd" sender: self];
   }
}

ViewController纵向和横向的课程。

您确定在界面生成器中将segue的标识符设置为ddd吗?