How to get cell indexpath in uitextfield Delegate Methods?

后端 未结 11 987
南旧
南旧 2020-12-08 22:56

I have two textfields in a custom cell how to get the indexpath value of Tableview cell in textfield delegate methods I want to get the input value from user and save it to

11条回答
  •  一生所求
    2020-12-08 23:00

    You can set the tags of textfields in cellForRowAtIndexPath: such that it stores info of both cell and text field

    For example : If it is cell in 4th row, tag of 1st and 2nd textfields can be 41 and 42 respectively. Similarly, tags of textfields should be 51 and 52 for 5th row and so on...

    Then in textfield delegate method, you can get textfield.tag to identify active textfield.

提交回复
热议问题