美文网首页
iOS - UITableView 添加一行动画

iOS - UITableView 添加一行动画

作者: HanZhiZzzzz | 来源:发表于2020-12-24 11:32 被阅读0次
-(void)addCell:(UIButton *)button{
    NSMutableArray *indexPaths = [[NSMutableArray alloc] init];
    NSInteger row = self.dataSource.count;
    NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row inSection:0];
    [indexPaths addObject: indexPath];
    //必须向tableView的数据源数组中相应的添加一条数据
    FoodDesc *foodDesc = [[FoodDesc alloc] init];
    foodDesc.DEFNAME = @"ios";
    foodDesc.DEFDESC = @"66";
    [self.dataSource addObject:foodDesc];
    [self.tableView beginUpdates];
    [self.tableView insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationFade];
    [self.tableView endUpdates];

}

摘自:https://www.cnblogs.com/justqi/p/6834331.html

相关文章

网友评论

      本文标题:iOS - UITableView 添加一行动画

      本文链接:https://www.haomeiwen.com/subject/gzfmnktx.html