单击保存后如何清除字段Swift 3
问题描述:
所以,我有一个像这样的tableview。单击保存后如何清除字段Swift 3
这是怎么看起来像空字段。点击行后,我可以选择选项,然后看起来像第二个图像。然而,在我点击保存在这个屏幕后,我想要清楚所有这些字段。我尝试过这样的代码,并将其放在我的viewWillAppear选项卡中。由于此视图是通过标签栏控制器访问的,因此viewDidLoad不会调用,但它仍然不起作用。有人可以告诉我,点击保存后我将如何清除字段。
self.categoryDisplayed = ""
self.collectionsDisplayed = ""
self.currencyNameDisplayed = ""
let indexpath = NSIndexPath(row: 0, section: 0)
let cell = tableView.dequeueReusableCell(withIdentifier: "listCell", for: indexpath as IndexPath) as! ListDataTableViewCell
if (!self.isMovingToParentViewController){
self.categoryDisplayed = ""
self.collectionsDisplayed = ""
cell.optionSelectedLabel.text! = ""
}
答
您可以重新载入你的数据是这样的:
tableview.reloadData()
刷新的实现代码如下 – Sneha