当我在 TableView 中添加一些文本时,它会从 tableview 的顶部显示,但我想从 tableView 的底部显示它。
1.我的 TableView 屏幕
当我在数组中添加用户输入的文本并刷新 tableView 时,它将从 TableView 的顶部加载,如下图所示。
但我想像下图一样从底部添加它。
你们能帮我吗,我怎样才能做到这一点?
谢谢
我可以从 TableView 底部绑定(bind)数据。感谢 Rajeshkumar R 对我的帮助。
第 1 步,对旋转 180 度的表格 View 应用变换
tableView.transform = CGAffineTransformMakeRotation(-M_PI);
第 2 步,在 tableView:cellForRowAtIndexPath 中将原始单元格旋转 180 度:
cell.transform = CGAffineTransformMakeRotation(M_PI);
第 3 步,反转您的数据源。如果您使用 NSMutableArray 在位置 0 插入新对象,而不是使用 AddObject... 现在,困难的部分是记住 left 是 right 和 right 只在表级别,所以如果你使用
[tableView insertRowsAtIndexPaths:targetPath withRowAnimation:UITableViewRowAnimationLeft]
关于ios - 在 TableView 中从底部添加新数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43781255/
欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) | Powered by Discuz! X3.4 |