如何滑动 - 在视图中为UITableView设置动画 [英] How do I slide - animate a UITableView in a view

查看:101
本文介绍了如何滑动 - 在视图中为UITableView设置动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在点击一个按钮时将UITableVIew滑动到一个视图中(而不是通过推动导航控制器顶部的视图),然后通过滑动,单击相同的按钮将其隐藏起来。
我希望tableView在当前视图中滑动。

I want to slide a UITableVIew into a view (NOT by pushing the view on top of Navigation Controller) on click of a button and then hide it back by sliding , on clicking of the same button. I want the tableView to slide inside a present view.

推荐答案

您可以将表视图的frame属性设置为将其移出屏幕或返回屏幕。

You animate the frame property of the table view to move it off screen or back onto screen.

下面是一些示例代码,用于将表格视图移出屏幕并在屏幕上移动另一个代码:

Here is some sample code that moves a table view off screen and moves another on screen in its place:

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:kSlideTableDuration];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(tableAnimationDidStop:finished:context:)];

self.tableView1.frame = offScreen;
self.tableView2.frame = onScreen;

[UIView commitAnimations];                      

您可以在 UIView文档

这篇关于如何滑动 - 在视图中为UITableView设置动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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