gpt4 book ai didi

iphone - 在 UITableView 中的当前行顶部插入行

转载 作者:行者123 更新时间:2023-12-03 21:08:49 26 4
gpt4 key购买 nike

有没有办法在现有行的顶部插入行,以便最新数据显示在最上面的行?谢谢!

最佳答案

是的,你可以使用
insertRowsAtIndexPaths:withRowAnimation:

在 .m 文件中所需的函数中,在 UITableView 对象上调用此方法,如下所示


[self.tableview insertRowsAtIndexPaths:indexPath withRowAnimation:YES];

其中indexPath包含行号。(您要放置单元格的位置)

NSArray *indexPath = [NSArray arrayWithObject:[NSIndexPath indexPathForRow:2 inSection:0]];

关于iphone - 在 UITableView 中的当前行顶部插入行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4720722/

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