开发者

How to mimic UINavigation animation behavior when transitioning between two UITableViews

开发者 https://www.devze.com 2023-04-09 19:22 出处:网络
I have a UIViewController that houses two UITableViews and swaps between the two. I\'m wondering how can I implement the exact same animation behavi开发者_JS百科or that a UINavigationController does w

I have a UIViewController that houses two UITableViews and swaps between the two. I'm wondering how can I implement the exact same animation behavi开发者_JS百科or 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];


Any reason you cant use two UIViewController:s?

If not you should be able to do it by animating the bounds property of both table views. You could probaby also do it by using a paged scroll view and just switch beteween pages.

0

精彩评论

暂无评论...
验证码 换一张
取 消