How to find which tableview is editing in textFieldDidEndEditing?

后端 未结 2 1307
不思量自难忘°
不思量自难忘° 2021-01-24 21:32

I am using 2 tableviews

both have textfiled in tableviewcell,

I am getting text of textfield in textFieldDidEndEdit

2条回答
  •  别那么骄傲
    2021-01-24 22:01

    Swift 3.x

    Assuming your hierarchy of textFiled is:

    TextField->Cell->TableView

    Write this line of code in textFieldDidEndEditing

    print(textField.superview?.superview)
    if textField.superview?.superview == myTable1 {
    
    }
    else if textField.superview?.superview == myTable2 {
    
    }
    else {
    
    }
    

提交回复
热议问题