iOS - 动画效果 - 图像弹出 [英] iOS - Animation effects - Image pop-in

查看:123
本文介绍了iOS - 动画效果 - 图像弹出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的iphone应用程序中弹出一个图像而不是只是出现。通过pop-in我的意思是它会从一个小点增长到它的实际大小。作为参考,这与Keynote中的pop动画效果完全相同。
我对iOS动画完全不熟悉,所以如果有人能指出我需要使用的动画效果方向,我们将非常感激。

I'd like to have an image in my iphone app "pop-in" on screen rather than just appearing. By "pop-in" I mean that it would grow from a small dot to its actual size. For reference, this is exactly the same as the "pop" animation effect in Keynote. I'm completely new to iOS animations, so if someone could point me in the direction on the animation effects I would need to use, it would be greatly appreciated.

谢谢

Brian

更新
我是从以下建议中添加了此代码。这有效,但它可以缩小我的图像,而不是向上。我知道这是因为我有0.01作为变换比例尺寸,但我想知道如何开始使用大小为0.0的图像并扩展到1.只需将图像的大小设置为0?
谢谢

UPDATE I've added this code from the suggestions below. This works but it scales my image down, rather than up. I know that is because I have 0.01 as the transform scale size, but I would like to know how I can start out with an image of size 0.0 and scale up to 1. Is it just a matter to setting the size of my image to 0? Thanks

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration: 0.2];
image.transform = CGAffineTransformMakeScale(0.01, 0.01);
[UIView setAnimationDelegate:self];
[UIView commitAnimations];


推荐答案

您正在寻找的效果是这样的:

The effect you’re looking for is something like this:

// instantaneously make the image view small (scaled to 1% of its actual size)
view.transform = CGAffineTransformMakeScale(0.01, 0.01);
[UIView animateWithDuration:0.2 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{
    // animate it to the identity transform (100% scale)
    view.transform = CGAffineTransformIdentity;
} completion:^(BOOL finished){
    // if you want to do something once the animation finishes, put it here
}];

这篇关于iOS - 动画效果 - 图像弹出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆