ios - Swift 3 - How to fire textFieldDidEndEditing before moveRowAt IndexPath? -
when start "edit mode" in tableview
, able (1) edit textfield
in cells , (2) move rows.
in order edit textfield
implemented code inside textfielddidendediting
, , move rows used moverowat indexpath
.
they work independently, if cannot save textfield
content before moverowat indexpath
fired...
the problem when do:
a) start editing.
b) tap textfield
, write something.
c) move row before taping textfield
.
-> row moving, textfield
not saving.
how can save textfield
before starting move rows?
you have maintain record of textfield value because if move row row moved , according swapping data source (array) assumed! so, have maintain record of text of textfield. can iplement textfield's delegate method "shouldchangecharacter" whenever type string in method , every time store latest string respective indexpath , set text textfield "cellforrow" after moving rows!
Comments
Post a Comment