ios - 重新排序数组以获得 TableView 中的最后一个

标签 ios swift uitableview

假设我的数组是这样的:

let test = ["1", "2", "3", "4", "5"]

在 tableView 中,它看起来像这样:

1

2

3

4

5

但我希望它看起来像这样:

5

4

3

2

1

我将其用于 cell.text:

cell.textLabel?.text = dataArray[indexPath.row] as? String

有什么建议吗?

最佳答案

我相信这应该有效。

dataArray[dataArray.count - 1 - indexPath.row]

关于ios - 重新排序数组以获得 TableView 中的最后一个,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33658698/

相关文章:

iOS Google 登录 SDK 问题

ios - 当我在应用程序中按创建帐户时,它会在没有任何信息的情况下创建帐户

json - 如何解决错误 : "Invalid type in JSON write (NSConcreteData)"

ios - UITableView 添加 FooterView 按钮有时点击不执行操作

iphone - 加载两种语言的英文版图像

javascript - 从 API 获取数据时如何存储数据

ios - UITableView section scrollBar 的背景色怎么弄清楚?

uitableview - 从 indexPathsForSelectedRows() 中提取数据 - SWIFT

ios - 如何在 swift 中将贴纸 View 添加到浏览器 View ?

ios - 如何通过命令行更改(越狱)iOS 代理设置?