Ali*_*are 55
使用UIView专用方法.
所以想象一下,你已经UIImageView准备好了,已经创建并添加到主视图中,但只是隐藏了.你的方法只需要让它可见,并在2秒后开始动画淡出它,通过将其"alpha"属性设置为1.0到0.0(在0.5s动画期间):
-(IBAction)popupImage
{
imageView.hidden = NO;
imageView.alpha = 1.0f;
// Then fades it away after 2 seconds (the cross-fade animation will take 0.5s)
[UIView animateWithDuration:0.5 delay:2.0 options:0 animations:^{
// Animate the alpha value of your imageView from 1.0 to 0.0 here
imageView.alpha = 0.0f;
} completion:^(BOOL finished) {
// Once the animation is completed and the alpha has gone to 0.0, hide the view for good
imageView.hidden = YES;
}];
}
Run Code Online (Sandbox Code Playgroud)
就那么简单!
Jos*_*raj 12
在Swift和XCode 6中
self.overlay.hidden = false
UIView.animateWithDuration(2, delay:5, options:UIViewAnimationOptions.TransitionFlipFromTop, animations: {
self.overlay.alpha = 0
}, completion: { finished in
self.overlay.hidden = true
})
Run Code Online (Sandbox Code Playgroud)
覆盖是我的图像的出口.
| 归档时间: |
|
| 查看次数: |
29737 次 |
| 最近记录: |