0

I am creating a calender app right now and I used a bunch of UITextFields to make up the content of the table view cell. I want to get the tableView cell number that it is in so I could save it to var events: [Dashboard] = [] because now everytime I add a new cell, it clears it all. I did try using EditingDidEnd

func tableView(_ tableView: UITableView, didEndEditingRowAt indexPath: IndexPath?) {
    let getIndexPathOfSelectionDelageteInstance: getIndexPathOfSelectionDelagete! = nil
    getIndexPathOfSelectionDelageteInstance.IndexpathValue(theTitle: (indexPath?.row)!)
}

but it dosen't work .It dosent even get called. I am assuming that manipulating something in the table view does not count as editing it.

Can someone help me? Thanks.

  • Can you describe more clearly what you are trying to do and show the code you have tried. Generally the cell doesn't need to know anything about the data model or its row number; it is just a view – Paulw11 Oct 27 '18 at 20:31
  • *"I use a bunch of UITextViews to make up the title of the table view"* - sounds strange... Why don't you use `tableHeaderView` property? – kelin Oct 27 '18 at 21:04
  • I think they are referring to the content of the cell, not the table title, but it is confusing – Paulw11 Oct 27 '18 at 21:06
  • If you want your view controller to be aware when a text field in a cell has been edited, your cell should implement the text field delegate or action method and notify your view controller via a delegate protocol you define or you can use a closure. See https://stackoverflow.com/questions/28659845/swift-how-to-get-the-indexpath-row-when-a-button-in-a-cell-is-tapped/38941510#38941510 – Paulw11 Oct 27 '18 at 22:24

0 Answers0