I am using 2 tableviews
both have textfiled
in tableviewcell
,
I am getting text of textfield in textFieldDidEndEditing
but how would i know text is being editing belongs to which tableview ,i just want to know the condition where i can differentiate text coming from textfield to store in two different array.
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)
}
}
}
}