在swift 3中重新加载部分方法? [英] Reload section method in swift 3?

查看:42
本文介绍了在swift 3中重新加载部分方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有用objective c编写的代码.我想把这段代码转换成swift3代码.

I have code written in objective c.I want to convert this code into the swift3 code.

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

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

After converting using online tool it gave me below code but it does not work

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

请告诉我怎么做?

推荐答案

Reload Section in Swift 3.0

Reload Section in Swift 3.0

即重新加载第 0 节到第 0 节,因为 tableview 有默认索引为0的一节.

i.e Reloading 0th section to 0th Section, Because tableview has default 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

在 Swift 5 中你可以使用这个简短的 &简单的线条.

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

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

这篇关于在swift 3中重新加载部分方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆