像Secret App一样的Uitableview Cell动画

San*_*007 2 animation objective-c uitableview ios

任何想法,我如何实现 - 秘密应用程序设置列表单元格动画.

我正在尝试这个,但没有任何成功,因为它同时添加所有行.

[self.tableview reloadSections:sectionIndexSet withRowAnimation:UITableViewRowAnimationBottom];

如果我逐个插入行,则此动画无法从底部到顶部动画.

有什么建议我怎么办?

Cla*_*dio 8

试试这个实现:

//From UITableViewDelegate calls
- (void)tableView:(UITableView *)tableView
  willDisplayCell:(UITableViewCell *)cell
forRowAtIndexPath:(NSIndexPath *)indexPath{
    CGRect myRect = [tableView rectForRowAtIndexPath:indexPath];

    //instead of 568, choose the origin of your animation
    cell.frame = CGRectMake(cell.frame.origin.x,
                            cell.frame.origin.y + 568,
                            cell.frame.size.width,
                            cell.frame.size.height);

    [UIView animateWithDuration:0.5 delay:0.1*indexPath.row options:UIViewAnimationOptionCurveEaseInOut animations:^{
        //instead of -30, choose how much you want the cell to get "under" the cell above
        cell.frame = CGRectMake(myRect.origin.x,
                                myRect.origin.y - 30,
                                myRect.size.width,
                                myRect.size.height);

    } completion:^(BOOL finished){
        [UIView animateWithDuration:0.5 animations:^{
            cell.frame = myRect;
        }];

    }];
}
Run Code Online (Sandbox Code Playgroud)