我尝试在视图中制作带有图像的动画,但无法正常工作:我的图像位于没有动画的最终位置。当视图呈现UIModalTransitionStyleFlipHorizontal时,动画无法正常工作
UIImage *myImg = [UIImage imageNamed : @"Img72.png"];
UIImageView *myImgView =[ [UIImageView alloc] initWithImage: myImg ];
myImgView.frame= CGRectMake(250,50,72,72);
[self.view addSubview:myImgView];
[UIView animateWithDuration:0.5
delay: 0.0
options: UIViewAnimationOptionCurveEaseInOut
animations:^{
[UIView setAnimationRepeatCount:100.0];
[UIView setAnimationRepeatAutoreverses:YES];
myImgView.frame= CGRectMake(50,250,72,72);
}
completion:NULL];
[myImgView release];
相同的动画代码在另一个视图中完美工作。我终于发现它来自我使用此代码显示的视图方式:
FlipsideViewController *controller = [[[FlipsideViewController alloc] initWithNibName:@"FlipsideViewController" bundle:nil] autorelease];
controller.delegate = self;
controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; //KO
[self presentModalViewController:controller animated:YES];
的问题是modalTransitionStyle
。当我评论该行(与/ /),它终于有效。我测试的其他过渡的风格和所有的其他作品(UIModalTransitionStyleCoverVertical
,UIModalTransitionStyleCrossDissolve
,UIModalTransitionStylePartialCurl
)
我做了一个viewDidLoadProject
(实用应用程序),只是添加了动画代码在这两个视图中viewDidLoad
方法。
问题在哪里?这是一个苹果的错误?我怎样才能有一个翻转过渡,我的动画在第二个视图中工作?
这里是我的示例项目:http://dl.dropbox.com/u/9204589/testFlipAnimation.zip
YEEEEESSSSSS,感谢您的快速和完美的答案:-)它是如此简单。正如我们在法国所说的那样,“J'avais latêtedans le guidon”。 – Alex 2012-03-19 23:12:59
BULLS眼睛!就是我想要的 – Siddharthan 2012-08-22 13:17:59