在两个UITableViews之间过渡时如何模仿UINavigation动画行为 [英] How to mimic UINavigation animation behavior when transitioning between two UITableViews

查看:64
本文介绍了在两个UITableViews之间过渡时如何模仿UINavigation动画行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个UIViewController,它包含两个UITableViews并在两者之间进行交换。我想知道如何在这两个UITableViews之间进行转换时实现与UINavigationController完全相同的动画行为? (即,一个tableView被另一个tableView从左向右或从右向左推出屏幕)。

I have a UIViewController that houses two UITableViews and swaps between the two. I'm wondering how can I implement the exact same animation behavior that a UINavigationController does when transitioning between these two UITableViews? (ie one tableView gets pushed off the screen left to right or right to left by the other tableView).

推荐答案

// Set table 2 up offscreen as starting state
CGRect rect = tableView2.frame;
rect.origin.x = rect.size.width;
tableView2.frame = rect;

// fill in any details you need for the animation
[UIView beginAnimation:...

// move 1 left offscreen
rect = tableView1.frame;
rect.origin.x = -rect.size.width;
tableView1.frame = rect;

// bring 2 right onscreen
rect = tableView2.frame;
rect.origin.x = 0;
tableView2.frame = rect;

[UIView commitAnimation];

这篇关于在两个UITableViews之间过渡时如何模仿UINavigation动画行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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