pushviewcontroller动画,而不实际调用pushviewcontroller [英] pushviewcontroller animation without actually calling pushviewcontroller

查看:270
本文介绍了pushviewcontroller动画,而不实际调用pushviewcontroller的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想动画响应用户操作我的观点看起来像动画的pushviewcontroller。也就是说,我想视图以响应于用户动作离屏向左滑动。不过,我不希望创建一个新的观点,并使用pushviewcontroller将其推入堆栈。我想重复使用相同的观点,并重新加载数据,我想用新的数据重装以期从右侧滑动,而且在动画pushviewcontroller会。你会怎么做呢?

感谢您的帮助!


<格CLASS =h2_lin>解决方案

在您的viewController执行此操作。这将它整个视图向右移动,然后2秒钟后回来。您可能希望让你有某种背景的移动只是一个子视图。

   - (无效)viewDidAppear:(BOOL)动画
{
    [UIView的animateWithDuration:1.2
                     动画:^ {
                         self.view.frame = CGRectMake(320,0,320,480);
                     }];    [自performSelector:@selector(slideBackView)withObject:无afterDelay:2.0];
} - (无效)slideBackView
{
    [UIView的animateWithDuration:1.2
                     动画:^ {
                         self.view.frame = CGRectMake(0,0,320,480);
                     }];
}

I would like to animate my view in response to a user action to look like the animation for a pushviewcontroller. That is, I want the view to slide off-screen to the left in response to the user action. However, I don't want to create a new view and push it onto the stack using pushviewcontroller. I want to reuse the same view and reload the data, and I want the reloaded view with the new data to slide in from the right, and it would in the animation for pushviewcontroller. How would you do this?

Thanks for any help!

解决方案

Do this in your viewController. This will move the whole view of it to the right and then after 2 seconds back. You may want to move only a subview so you have some kind of background.

- (void)viewDidAppear:(BOOL)animated
{
    [UIView animateWithDuration:1.2 
                     animations:^{
                         self.view.frame = CGRectMake(320, 0, 320, 480);
                     }];

    [self performSelector:@selector(slideBackView) withObject:nil afterDelay:2.0];
}

- (void)slideBackView
{
    [UIView animateWithDuration:1.2 
                     animations:^{
                         self.view.frame = CGRectMake(0, 0, 320, 480);
                     }];
}

这篇关于pushviewcontroller动画,而不实际调用pushviewcontroller的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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