-1

我为 iPhone 编写了一个小型多人游戏。一旦其中一名球员获胜,我想在 ImageView 中显示他的“You Win”图像。我想制作一个动画,将这个 UIImageView 显示在当前游戏视图的顶部,并从底部动画滑动。这个 UIImageView 将填满整个屏幕,同时使用透明度使其成为模态,所以在后台我仍然会看到游戏状态。这是如何使用 UIView transitionWithView 完成的?

4

1 回答 1

2

考虑将您的视图设置为 someView 的动画。someView 的初始框架是bottomRect,即视图的底部。最终位置为 topRect。

//set initial frame
someView. frame = bottomRect;

// initially it will be completely transparent
SomeView. alpha=0.0;

// animationTime is time to complete animation
// delayTime is time delay after which animation will start
[UIView animateWithDuration: animationTime delay: delayTime options: UIViewAnimationCurvelineari
animations:^{
    someView. frame = topRect;
    someView. alpha = 1.0;
} 
completion:^(BOOL finished){
    NSLog(@"Done!");
}];
于 2012-08-27T15:45:29.240 回答