在创建表View之前获取IndexPath.row和IndexPath.section

时间:2016-04-22 07:05:34

标签: ios swift tableview reload tableviewcell

我想将特定的UITableViewCell更新为Swift IOS。

" reloadRowsAtIndexPaths"用于更新特定的UITableViewCell

self.tableView.reloadRowsAtIndexPaths([indexPath], withRowAnimation: UITableViewRowAnimation.None)

我的关注是"如何获得IndexPath.rowIndexPath.section" ([indexPath] {}创建UITableView之前,我想传递两者来更新特定的UItableViewCell

1 个答案:

答案 0 :(得分:0)

            tableView.reloadRowsAtIndexPaths([NSIndexPath(forRow: 0, inSection: 0)], withRowAnimation: .None)

使用此方法,您可以初始化NSIndexPath变量。 []括号,因为reloadRowsAtIndexPath需要一个数组作为参数。

NSIndexPath初始化程序中的参数非常简单我想(forRow - >哪一行| inSection - >哪个部分

hf;)