2017-10-18 108 views
0

所以,我有一個像這樣的tableview。單擊保存後如何清除字段Swift 3

enter image description here

這是怎麼看起來像空字段。點擊行後,我可以選擇選項,然後看起來像第二個圖像。然而,在我點擊保存在這個屏幕後,我想要清楚所有這些字段。我嘗試過這樣的代碼,並將其放在我的viewWillAppear選項卡中。由於此視圖是通過標籤欄控制器訪問的,因此viewDidLoad不會調用,但它仍然不起作用。有人可以告訴我,點擊保存後我將如何清除字段。

enter image description here

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! = "" 
    } 
+1

刷新的實現代碼如下 – Sneha

回答

1

您可以重新載入你的數據是這樣的:

tableview.reloadData()