iphone的UIView动画调整像水消失,回来浮动 [英] iphone UIview animation resize in like disappear in water and comes back floating

查看:269
本文介绍了iphone的UIView动画调整像水消失,回来浮动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不想淡入和淡出像UIView的动画最常见的解决方案。我想有UIView的大小调整为小直到消失,回来以同样的方式。说这是有一个摄像头在桌子与它(的UIView)和相机中的所有对象指向密切另一种方式备份和越备份表变得越小。这就是为什么我题目主要是我的应用程序整个的UIView沉入水中漂浮和备份。我希望我会找到一个教程或为解决别人的建议。一切调整/缩小屏幕的中间/中心。

I don't want to fade in and fade out like most common solution for the uiview animation. I would like to have the uiview resize to small until it disappear and comes back the same way. Another way to say it is having a camera pointing closely at the table with all the object in it (UIView) and camera backs up and the more it backs up the smaller the table gets. Which is why i titled which is mainly my app the whole uiview sinks into the water and floats back up. Hopefully i'll find a tutorial or someone's suggestion for the solution. everything resize/shrinks in the middle/center of the screen.

更新***
我想它在屏幕的任意位置缩小,并从屏幕还随机位置出现。
另外从其他类我在子视图中的MainView viewDidLoad中
(查看= [[查看页头] initWithFrame:方法CGRectMake(0,40,300,300);)

UPDATE*** i would like it to shrink in random position of the screen and appear from random position of the screen also. Also my subview from other class is viewdidload in mainView (View = [[View alloc] initWithFrame:CGRectMake(0, 40, 300, 300)];)

推荐答案

试试这个,其中视图是要搞乱的观点:

Try this, where view is the view you are messing with:

CGRect originalFrame = view.frame;

[UIView animateWithDuration:1.0 delay:0.0 options:UIViewAnimationCurveEaseInOut animations:^{
    CGRect frame = view.frame;
    frame.origin = view.center;
    frame.size = CGSizeMake( 0, 0 );
    view.frame = frame;
} completion:^(BOOL finished) {
    // Do something with the view

    [UIView animateWithDuration:1.0 delay:0.0 options:UIViewAnimationCurveEaseInOut animations:^{
        view.frame = originalFrame;
    } completion:^(BOOL finished) {
        return;
    }];

    return;
}];

这篇关于iphone的UIView动画调整像水消失,回来浮动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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