Como descobrir qual tableview está editando no textFieldDidEndEditing?
Estou usando 2tableviews
ambos têmtextfiled
notableviewcell
,
Estou recebendo texto do campo de texto emtextFieldDidEndEditing
mas como eu saberia que o texto está sendo editado pertence a qual tableview, eu só quero saber a condição em que posso diferenciar o texto do campo de texto para armazenar em duas matrizes diferentes.
func textFieldDidEndEditing(_ textField: UITextField)
{
// let indexOf = txtArray.index(of:textField.tag)
if self.tblAnswer.isEditing
{
let indexOf = textField.tag
if let text = textField.text
{
if allAnsText.indices.contains(indexOf)
{
allAnsText.remove(at: indexOf)
}
if text.isEmpty
{
print("Write some text there")
}
else
{
allAnsText.insert(text, at: indexOf)
print(allAnsText)
}
}
}
else if self.tblVideo.isEditing
{
let indexOf = textField.tag
if let text = textField.text
{
if allMediaText.indices.contains(indexOf)
{
allMediaText.remove(at: indexOf)
}
if text.isEmpty
{
print("Write some text there")
}
else
{
allMediaText.insert(text, at: indexOf)
print(allMediaText)
}
}
}
}