【问题标题】:Animating a Uitableviewcell为 Uitableviewcell 设置动画
【发布时间】:2012-08-23 04:24:39
【问题描述】:

Tweetbot 在 UITableViewCell 向右滑动时添加了一些很酷的动画,最终揭示了让我好奇的对话:如何为 UITableViewCell 设置动画以使其远离 tableview 的正常框架?

另外,您如何为表格单元顶部的其他视图设置动画?像 UIActivityMonitor 或淡入淡出按钮?

我不是在寻找何时进入编辑模式或被选中的答案,而是在一般情况下寻找答案。谢谢各位。

【问题讨论】:

  • 将滑动手势添加到单元格并在右侧滑动时,将单元格的框架更改为新框架。

标签: objective-c iphone uitableview cocoa-touch core-animation


【解决方案1】:
CGPoint location = [recognizer locationInView:tblview];
NSIndexPath* indexPath = [tblAim indexPathForRowAtPoint:location];

ProjectCell *cell = (ProjectCell *) [tblAim cellForRowAtIndexPath:indexPath];

if(cell.frame.origin.x!=0)
[UIView animateWithDuration:0.3 animations:^{  [cell setFrame:CGRectMake(0,cell.frame.origin.y, 320, 60 )];} completion:^(BOOL finish){
[UIView animateWithDuration:0.1 animations:^{[cell setFrame:CGRectMake(0-10,cell.frame.origin.y, 320, 60 )];} completion:^(BOOL finish){
[UIView animateWithDuration:0.1 animations:^{[cell setFrame:CGRectMake(0,cell.frame.origin.y, 320, 60 )];}];
                }];
            }];

【讨论】:

  • 对单元格内容视图的动画视图有什么想法吗?
  • 没试过,但我认为你可以在 contentview 中添加手势并为其设置动画。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-02-10
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多