gpt4 book ai didi

ios - Uitableview Cell Animation like Secret App

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:58:04 29 4
gpt4 key购买 nike

任何想法,我该如何实现- Secret App设置列表单元动画。

我正在尝试这样做,但没有成功,因为它同时添加了所有行。

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

如果我逐行插入,则此动画无法从下到上运行。

有什么建议我该怎么做?

最佳答案

试试这个实现:

//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;
}];

}];
}

关于ios - Uitableview Cell Animation like Secret App,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25250247/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com