我试着构建一个始终处于landsscape模式的应用程序。
我做了一些平常的事:
plist添加了uiinterfaceorientation/uiinterfaceorientationlandscaperight
使用视图顶部的小箭头旋转界面生成器中的xibs。
my code for launching:
- (void)applicationDidFinishLaunching:(UIApplication *)application {
[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeRight];
FlipViewController *flip = [[FlipViewController alloc] initWithNibName:@"FlipViewController" bundle:nil];
[window addSubview:flip.view];
[window makeKeyAndVisible];
}
但当我尝试执行“uiviewAnimationTransitionFromLeft”时,页面会从上到下而不是从右到左翻转。- -
这是我用来翻转视图的代码:
[UIView beginAnimations:@"View Flip" context:nil];
[UIView setAnimationDuration:1.25];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
UIViewController *coming = nil;
UIViewController *going = nil;
UIViewAnimationTransition transition;
if (self.blueViewController.view.superview == nil)
{
coming = blueViewController;
going = yellowViewController;
transition = UIViewAnimationTransitionFlipFromLeft;
}
else
{
coming = yellowViewController;
going = blueViewController;
transition = UIViewAnimationTransitionFlipFromRight;
}
[UIView setAnimationTransition: transition forView:self.view cache:YES];
[coming viewWillAppear:YES];
[going viewWillDisappear:YES];
[going.view removeFromSuperview];
[self.view insertSubview: coming.view atIndex:0];
[going viewDidDisappear:YES];
[coming viewDidAppear:YES];
[UIView commitAnimations];
“窗户”似乎忽略了一个事实,那就是它是在陆地上。六羟甲基三聚氰胺六甲醚。
有人能发现我的错误吗?