【发布时间】:2012-04-03 19:28:35
【问题描述】:
我试图通过单击一个按钮在一个屏幕中翻转两个视图,即我想同时拥有多个动画(例如:按钮和视图同时翻转的 iPhone 音乐播放器)
p.s-我不想一个接一个地动画视图,应该一起做
编辑
这是我使用的代码,请帮帮我
[UIView beginAnimations:nil context:nil];
[UIView animateWithDuration:0.8 animations:^{
if (viewDisplay)
{
[fareView removeFromSuperview];
[containerView addSubview:mapView];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:containerView cache:YES];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:buttonView cache:YES];
viewDisplay = FALSE;
swapLabel.text = @"Fare View";
[mapOrFare setImage:[UIImage imageNamed:@"original_icon.png"] forState:UIControlStateNormal];
}
else
{
[mapView removeFromSuperview];
[containerView addSubview:fareView];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:containerView cache:YES];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:buttonView cache:YES];
viewDisplay = TRUE;
swapLabel.text = @"Map View";
[mapOrFare setImage:[UIImage imageNamed:@"Map.png"] forState:UIControlStateNormal];
}
}];
[UIView commitAnimations];
【问题讨论】:
-
我尝试使用 [UIView beginAnimation..] 为两个子视图设置动画。 . [UIView commitAnimation] 块,但只有一个视图是动画的。另一个只是出现。
标签: iphone objective-c animation view flip