【发布时间】:2010-02-28 13:52:46
【问题描述】:
我尝试构建一个始终处于横向模式的应用程序。 我做了通常的事情: plist 添加了 UIInterfaceOrientation / UIInterfaceOrientationLandscapeRight 使用顶部视图中的小箭头旋转界面生成器中的 XIB。
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];
}
但是当我尝试执行“UIViewAnimationTransitionFlipFromLeft”时,页面会从上到下而不是从右到左翻转。 :-/
这是我用来翻转视图的代码:
[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];
"window" 似乎忽略了它处于横向模式的事实。嗯。 谁能发现我的错误?
【问题讨论】:
标签: iphone sdk view core-animation flip