Get uitextfield data from custom uitableview cell - Swift

前端 未结 2 1135
一生所求
一生所求 2021-01-27 06:58

I have a problem with custom tableview cell with a textfield. So, I have a separate class for a cell with a textfield, but I can\'t retrieve data in my tableview class. There is

2条回答
  •  醉酒成梦
    2021-01-27 07:25

    You can get cell textField data anywhere where your tableView is declared just use the following code

    let indexPath = IndexPath(row: yourRow, section: yourSection)
    let cell:InputDataCell = yourTable.cellForRow(at: indexPath) as! InputDataCell
    
    if (cell.yourTextFieald.text?.characters.count)! {
        print(cell.yourTextFieald.text!)                           
    }
    

提交回复
热议问题