【问题标题】:Rotate portrait to landscape and portrait mode of my view controller将纵向旋转到我的视图控制器的横向和纵向模式
【发布时间】:2011-02-01 20:33:31
【问题描述】:

通常我的应用程序以纵向模式显示所有视图,报告视图除外。仅当我在设置视图中并将设备旋转到横向模式时才会显示报告视图。现在,当我再次将设备旋转到纵向模式时,报告视图将被关闭并显示设置视图。

In report view 

> shouldAutorotateToInterfaceOrientation

return ((interfaceOrientation == UIInterfaceOrientationLandscapeRight)||( interfaceOrientation == UIInterfaceOrientationLandscapeLeft));



Here at settings view 

    shouldAutorotateToInterfaceOrientation


    if((interfaceOrientation == UIInterfaceOrientationLandscapeRight)||( interfaceOrientation == UIInterfaceOrientationLandscapeLeft))
     {  

     Report *report = [[Report alloc]initWithNibName:@"Report" bundle:[NSBundle mainBundle]]; 
     [self.navigationController pushViewController:report animated:YES];
     [report release];

     }
     return YES;
     }

【问题讨论】:

  • 您面临的具体问题是什么?您可以在横向模式下查看您的报告视图吗?如果是,请说明您需要的下一步。
  • 只有当我理解你的问题时,我才能为你提供帮助。但是您无法用正确的英语向我解释。那就是我试图修改你的问题,在某种程度上,我理解你的问题。请再次阅读修改后的问题,如果我的解释正确,请告诉我?

标签: iphone xcode interface-orientation


【解决方案1】:

不要在 shouldRotate... 中创建您的视图控制器,而是在 willRotateToInterfaceOrientation:duration: 中创建您的视图控制器,这是您应该响应旋转的地方。在您的 shouldAutorotateToInterfaceOrientation: 中,当您希望能够旋转到该方向时,只需返回 YES - 在您的情况下,您似乎想要所有方向,或者除 PortraitUpsideDown 之外的所有方向。

在您的willRotateToInterfaceOrientation:duration: 中,您可以根据需要推送您的视图控制器或弹出它。

【讨论】:

    猜你喜欢
    • 2012-12-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多