简体   繁体   English

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

[英]get the IndexPath.row and IndexPath.section Before Creation of the table View

I want to update a particular UITableViewCell into the Swift IOS.我想将特定的UITableViewCell更新到 Swift IOS 中。

" reloadRowsAtIndexPaths " is used for updating the particular UITableViewCell , reloadRowsAtIndexPaths ”用于更新特定的UITableViewCell

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

My Concern is "How to get the IndexPath.row and IndexPath.section " ([indexPath] for this Case ) before creating the UITableView , i want to pass both to update the particular UItableViewCell .我关心的是在创建UITableView之前“如何获取IndexPath.rowIndexPath.section([indexPath]本案例的([indexPath] ),我想通过两者来更新特定的UItableViewCell

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

With this you can init a NSIndexPath variable.有了这个,你可以初始化一个 NSIndexPath 变量。 [] brackets because reloadRowsAtIndexPath wants an array of those as parameter. [] 括号,因为 reloadRowsAtIndexPath 需要一个数组作为参数。

Parameters in NSIndexPath initializer are pretty straight forward i guess (forRow --> which row | inSection --> which section我猜 NSIndexPath 初始值设定项中的参数非常简单(forRow --> which row | inSection --> which section

hf ;)高频;)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM