Managing Delegate of UITextFields in Custom UITableViewCell

后端 未结 5 1558
长情又很酷
长情又很酷 2021-01-17 13:05

So I have looked around a quite a bit, and nothing on here seems to explain exactly the correct way of doing this. I have 7 UITextFields within a custom UITableViewCell.

5条回答
  •  迷失自我
    2021-01-17 13:51

    My suggestion would be to "tag" (i.e. set the tag) of each textField with a value that encodes the section, row, and one-of-7 text views in the table, then make the UIViewController the delegate.

    So you need to bound the size of these - say you will never have more than 100 rows. So you encode this as:

    .tag = 1000*section + 100*row +

    When you get a message you can have a method/function take the tag and decode it into section, row, tag, and do what you need to have done.

提交回复
热议问题