Ale*_*lex 17 iphone animation cocoa-touch core-animation uitableview
我想用一个UITableView
很酷的动画效果将一行移到我的底部,就像在这个Grocery Shopping List应用程序中一样.
就像我们可以使用重新排序控件移动行一样:
我该如何创建这样的动画?
Joo*_*ony 26
在IOS 5中,可以使用以下UITableView
选择器完成此操作:
- (void)moveRowAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath
Run Code Online (Sandbox Code Playgroud)
例如:
[self.tableView moveRowAtIndexPath:indexPath toIndexPath:[NSIndexPath indexPathForRow:[items count] - 1 inSection:1]];
Run Code Online (Sandbox Code Playgroud)
重要提示:此答案假设为iPhone OS 3.x. 请参阅上面的iOS 5.x 答案
我不知道什么是"酷炫的动画效果就像在杂货店购物清单应用程序".不是每个人都有这个应用.
无法以编程方式移动行.
但是,您可以同时插入和删除行以模拟移动.
[tableView beginUpdates];
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:rowToMove]
withRowAnimation:UITableViewRowAnimationLeft];
[tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:indexPathToMoveTo]
withRowAnimation:UITableViewRowAnimationLeft];
// update your dataSource as well.
[tableView endUpdates];
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
16932 次 |
最近记录: |