如何使在iphone上改变看法溶解动画? [英] How to make dissolve animation on changing views on iphone?

查看:112
本文介绍了如何使在iphone上改变看法溶解动画?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使溶解在iphone改变看法动画?

How to make dissolve animation on changing views in iphone?

Dissolve效果:一种观点是没有任何动静变化的另一个

Dissolve effect: one view is changing another without any movement.

非常感谢您的帮助!

推荐答案

您正在寻找的动画是:

[UIView animateWithDuration: 1.0
                 animations:^{
                     view1.alpha = 0.0;
                     view2.alpha = 1.0;
                 }];

一个更完整的解决方案,使用该动画可能是:

A more complete solution, using that animation might be:

- (void) replaceView: (UIView *) currentView withView: (UIView *) newView
{
    newView.alpha = 0.0;
    [self.view addSubview: newView];

    [UIView animateWithDuration: 1.0
                     animations:^{
                         currentView.alpha = 0.0;
                         newView.alpha = 1.0;
                     } 
                     completion:^(BOOL finished) {
                         [currentView removeFromSuperview];
                     }];
}

这篇关于如何使在iphone上改变看法溶解动画?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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