gpt4 book ai didi

ios - 在 swift 3 中重新加载部分方法?

转载 作者:IT王子 更新时间:2023-10-29 05:10:35 26 4
gpt4 key购买 nike

我有用 objective-c 编写的代码。我想将此代码转换为 swift3 代码。

[_expandableTableView reloadSections:[NSIndexSet indexSetWithIndex:gestureRecognizer.view.tag] withRowAnimation:UITableViewRowAnimationAutomatic];

使用在线工具转换后,它给了我下面的代码,但它不起作用

expandableTableView.reloadSections(IndexSet(index: gestureRecognizer.view!.tag), with: .automatic)

请告诉我怎么做?

最佳答案

Swift 3.0 中重新加载部分

i.e Reloading 0th section to 0th Section, Because tableview hasdefault one section that index is 0.

//let myRange: ClosedRange = 0...0

self.tableViewPostComments.reloadSections(IndexSet(integersIn: 0...0), with: UITableViewRowAnimation.top)

对于 Swift 4

self.tableViewPostComments.reloadSections(IndexSet(integersIn: 0...0), with: UITableView.RowAnimation.top)

对于 Swift 5

In Swift 5 you can use this short & simple line.

self.tableViewPostComments.reloadSections(IndexSet(integersIn: 0...0), with: .top)

关于ios - 在 swift 3 中重新加载部分方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40376728/

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