我有 2 个 GUI 和 2 个 Controller 1 称为 landscapeguicontroller,第二个称为 highguicontroller。
现在我通常调用 highguicontroller,当我旋转我的 iPhone 时它会检测到它,然后它会显示 landscapeguicontroller: 代码:
landscapeguicontroller *neu =[[landscapeguicontroller alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:neu animated:YES];
[self dismissModalViewControllerAnimated:YES];
问题是动画将新窗口从 iphone 的另一边向上推到窗口中。
在 Landscapeguicontroller 中,我添加了以下几行:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
当我想回到 highguicontroller 时,我调用:
[self dismissModalViewControllerAnimated:YES];
一切正常,但在第二个动画中我看到了正确的“旋转动画”。 你有什么建议吗?
所以简短的问题描述: 1.动画中从高到风景,风景被插入窗口 但是在 2. 从风景到高的动画中,旋转看起来像真正的旋转......
我希望 1.animation 看起来像 2.animation
最好的问候 普罗岑内德
最佳答案
为了避免“问题是动画将新窗口从 iphone 的另一边推到窗口中。”,请尝试将 View Controller 的 modalTransitionStyle 属性设置为以下之一,无论您喜欢什么: typedef 枚举 { UIModalTransitionStyleCoverVertical = 0, UIModalTransitionStyleFlipHorizontal, UIModalTransitionStyleCrossDissolve, } UIModalTransitionStyle;
另外,如果你想避免动画旋转,你可以设置你的 shouldRotate... 方法来禁止其他方向,然后设置为在设备物理改变方向时接收通知,并在适当的方向。有关此示例,请参阅 Apple 的“AlternateViews”示例代码。
通知反射(reflect)了设备的物理方向,无论界面是否允许更改,您都可以收到它们。 (您可以查看 UIApplications 的 statusBarOrientation 属性以了解 UI 的方向)。
关于objective-c - 带 2 XIB 的旋转人像风景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1581563/